Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3506f9ff9f | ||
|
a7a3bafcdc | ||
|
dbef80b91f | ||
|
3f9eda45b6 |
661
LICENSE.txt
661
LICENSE.txt
@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
40
Makefile
40
Makefile
@ -1,40 +0,0 @@
|
|||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
info:
|
|
||||||
@echo "Achtung: nur auf Entwicklungs- und Testservern einsetzen!"
|
|
||||||
@echo "make build: build the jar files"
|
|
||||||
@echo "make psql: start psql shell on the database"
|
|
||||||
@echo "make resetdata: reset the data in the database"
|
|
||||||
@echo "make run: run catalina and watch the output"
|
|
||||||
@echo "make test: run all continuous integration tests"
|
|
||||||
@echo "make testdomain: run one specific test for domains"
|
|
||||||
|
|
||||||
build:
|
|
||||||
source ~/.profile
|
|
||||||
cd ~/hsadmin/util && mvn clean install
|
|
||||||
cd ~/hsadmin/qserv && mvn clean install
|
|
||||||
cd ~/hsadmin/hsarback && mvn package -DskipTests
|
|
||||||
cp ~/hsadmin/qserv/target/hsadmin-*.jar ~/tomcat7/webapps/hsar/WEB-INF/lib/
|
|
||||||
cp ~/hsadmin/util/target/hsadmin-*.jar ~/tomcat7/webapps/hsar/WEB-INF/lib/
|
|
||||||
cp ~/hsadmin/hsarback/target/hsar.war ~/tomcat7/webapps
|
|
||||||
|
|
||||||
|
|
||||||
resetdata:
|
|
||||||
psql -U tim03_hsatest < ~/hsadmin/hsarback/database/dropschema.sql
|
|
||||||
psql -U tim03_hsatest < ~/hsadmin/hsarback/database/schema.sql
|
|
||||||
psql -U tim03_hsatest < ~/hsadmin/hsarback/database/data.sql
|
|
||||||
|
|
||||||
test: resetdata
|
|
||||||
source ~/.profile
|
|
||||||
cd ~/hsadmin/hsarback && mvn test -Dtest=ContinuousIntegrationTest
|
|
||||||
|
|
||||||
testdomain: resetdata
|
|
||||||
source ~/.profile
|
|
||||||
cd ~/hsadmin/hsarback && mvn test -Dtest=InitDataTest && mvn test -Dtest=DomainTest
|
|
||||||
|
|
||||||
run:
|
|
||||||
source ~/.profile
|
|
||||||
cd ~/tomcatmq && ./bin/catalina.sh run
|
|
||||||
|
|
||||||
psql:
|
|
||||||
WHOAMI=`whoami` && psql -U $${WHOAMI//\-/_}
|
|
8
authenticator/.classpath
Normal file
8
authenticator/.classpath
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
|
<classpathentry kind="lib" path="lib/cas-server-core-3.4.2.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
2
authenticator/.gitignore
vendored
Normal file
2
authenticator/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/bin
|
17
authenticator/.project
Normal file
17
authenticator/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>authenticator</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
12
authenticator/.settings/org.eclipse.jdt.core.prefs
Normal file
12
authenticator/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#Tue Sep 07 14:25:06 CEST 2010
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.6
|
30
authenticator/.settings/org.eclipse.jst.jsp.core.prefs
Normal file
30
authenticator/.settings/org.eclipse.jst.jsp.core.prefs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#Tue Sep 07 16:36:06 CEST 2010
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
validateFragments=false
|
||||||
|
validation.actions-missing-required-attribute=-1
|
||||||
|
validation.actions-non-empty-inline-tag=-1
|
||||||
|
validation.actions-unexpected-rtexprvalue=-1
|
||||||
|
validation.actions-unknown-attribute=-1
|
||||||
|
validation.directive-include-fragment-file-not-found=-1
|
||||||
|
validation.directive-include-fragment-file-not-specified=-1
|
||||||
|
validation.directive-taglib-duplicate-prefixes-different-uris=-1
|
||||||
|
validation.directive-taglib-duplicate-prefixes-same-uris=-1
|
||||||
|
validation.directive-taglib-missing-prefix=-1
|
||||||
|
validation.directive-taglib-missing-uri-or-tagdir=-1
|
||||||
|
validation.directive-taglib-unresolvable-uri-or-tagdir=-1
|
||||||
|
validation.el-general-syntax=-1
|
||||||
|
validation.el-lexical-failure=-1
|
||||||
|
validation.java-=-1
|
||||||
|
validation.java-local-variable-is-never-used=-1
|
||||||
|
validation.java-null-local-variable-reference=-1
|
||||||
|
validation.java-potential-null-local-variable-reference=-1
|
||||||
|
validation.java-unused-import=-1
|
||||||
|
validation.translation-tag-class-not-found=-1
|
||||||
|
validation.translation-tei-class-not-found=-1
|
||||||
|
validation.translation-tei-class-not-instantiated=-1
|
||||||
|
validation.translation-tei-class-runtime-exception=-1
|
||||||
|
validation.translation-tei-message=-1
|
||||||
|
validation.translation-usebean-ambiguous-type-info=-1
|
||||||
|
validation.translation-usebean-invalid-id=-1
|
||||||
|
validation.translation-usebean-missing-type-info=-1
|
||||||
|
validation.use-project-settings=true
|
18
authenticator/.settings/org.eclipse.wst.validation.prefs
Normal file
18
authenticator/.settings/org.eclipse.wst.validation.prefs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#Tue Sep 07 16:37:46 CEST 2010
|
||||||
|
DELEGATES_PREFERENCE=delegateValidatorList
|
||||||
|
USER_BUILD_PREFERENCE=enabledBuildValidatorList
|
||||||
|
USER_MANUAL_PREFERENCE=enabledManualValidatorList
|
||||||
|
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationtrueversion1.2.200.v201005271900
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
override=true
|
||||||
|
suspend=true
|
||||||
|
vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01
|
||||||
|
vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01
|
||||||
|
vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01
|
||||||
|
vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01
|
||||||
|
vals/org.eclipse.wst.html.ui.HTMLValidator/global=FF01
|
||||||
|
vals/org.eclipse.wst.wsdl.validation.wsdl/global=FF02158org.eclipse.wst.wsdl.validation.internal.eclipse.Validator
|
||||||
|
vals/org.eclipse.wst.xml.core.xml/global=FF03
|
||||||
|
vals/org.eclipse.wst.xsd.core.xsd/global=FF02162org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator
|
||||||
|
vals/org.eclipse.wst.xsl.core.xsl/global=FF02
|
||||||
|
vf.version=3
|
12
authenticator/.settings/org.eclipse.wst.xsl.core.prefs
Normal file
12
authenticator/.settings/org.eclipse.wst.xsl.core.prefs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#Tue Sep 07 16:36:08 CEST 2010
|
||||||
|
CHECK_CALL_TEMPLATES=2
|
||||||
|
CHECK_XPATHS=2
|
||||||
|
CIRCULAR_REF=2
|
||||||
|
DUPLICATE_PARAMETER=2
|
||||||
|
EMPTY_PARAM=1
|
||||||
|
MISSING_INCLUDE=2
|
||||||
|
MISSING_PARAM=1
|
||||||
|
NAME_ATTRIBUTE_EMPTY=2
|
||||||
|
NAME_ATTRIBUTE_MISSING=2
|
||||||
|
TEMPLATE_CONFLICT=2
|
||||||
|
eclipse.preferences.version=1
|
35
authenticator/build.xml
Normal file
35
authenticator/build.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<project name="authenticator" default="default" basedir=".">
|
||||||
|
|
||||||
|
<property file="${user.home}/.ant.hsar.properties" />
|
||||||
|
<property name="lib.home" value="${basedir}/lib" />
|
||||||
|
<property name="src.home" value="${basedir}/src" />
|
||||||
|
<property name="war.home" value="${basedir}/webapp" />
|
||||||
|
<property name="cls.home" value="${war.home}/WEB-INF/classes" />
|
||||||
|
<property name="compile.debug" value="true" />
|
||||||
|
|
||||||
|
<path id="compile.classpath">
|
||||||
|
<fileset dir="lib">
|
||||||
|
<include name="*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<target name="default" depends="compile" description="Patch WAR File">
|
||||||
|
<echo message="target war: ${cas.openedwar}"/>
|
||||||
|
<copy todir="${cas.openedwar}">
|
||||||
|
<fileset dir="${war.home}"/>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" description="Compile Authenticator">
|
||||||
|
<javac srcdir="${src.home}" destdir="${cls.home}" debug="${compile.debug}">
|
||||||
|
<classpath refid="compile.classpath" />
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean" description="Remove compiled classes">
|
||||||
|
<delete dir="${cls.home}/de"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
BIN
authenticator/lib/cas-server-core-3.4.2.1.jar
Normal file
BIN
authenticator/lib/cas-server-core-3.4.2.1.jar
Normal file
Binary file not shown.
BIN
authenticator/lib/commons-codec-1.4.jar
Normal file
BIN
authenticator/lib/commons-codec-1.4.jar
Normal file
Binary file not shown.
143
authenticator/src/de/hsadmin/cas/SmtpAuthenticator.java
Normal file
143
authenticator/src/de/hsadmin/cas/SmtpAuthenticator.java
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
package de.hsadmin.cas;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.jasig.cas.authentication.handler.AuthenticationException;
|
||||||
|
import org.jasig.cas.authentication.handler.AuthenticationHandler;
|
||||||
|
import org.jasig.cas.authentication.principal.Credentials;
|
||||||
|
import org.jasig.cas.authentication.principal.UsernamePasswordCredentials;
|
||||||
|
|
||||||
|
public class SmtpAuthenticator implements AuthenticationHandler {
|
||||||
|
|
||||||
|
private static final int SMTPS_PORT = 465;
|
||||||
|
|
||||||
|
public boolean authenticate(Credentials creds)
|
||||||
|
throws AuthenticationException {
|
||||||
|
UsernamePasswordCredentials ucreds = (UsernamePasswordCredentials) creds;
|
||||||
|
try {
|
||||||
|
return isAuthenticated(ucreds.getUsername(), ucreds.getPassword());
|
||||||
|
} catch (SmtpAuthException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supports(Credentials creds) {
|
||||||
|
return creds instanceof UsernamePasswordCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAuthenticated(String user, String passwd)
|
||||||
|
throws SmtpAuthException {
|
||||||
|
boolean isAuth = false;
|
||||||
|
Socket socket = null;
|
||||||
|
try {
|
||||||
|
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||||
|
sc.init(null, null, null);
|
||||||
|
SSLSocketFactory ssf = sc.getSocketFactory();
|
||||||
|
if ( user == null || user.length() < 2 || user.length() == 4 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (user.indexOf('@') > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (user.length() == 2) {
|
||||||
|
user = "hsh01-" + user;
|
||||||
|
}
|
||||||
|
if (user.length() == 3) {
|
||||||
|
user = "hsh00-" + user;
|
||||||
|
}
|
||||||
|
socket = ssf.createSocket(user.substring(0, 5)
|
||||||
|
+ ".hostsharing.net", SMTPS_PORT);
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Writer out = new OutputStreamWriter(socket.getOutputStream(),
|
||||||
|
"ISO-8859-1");
|
||||||
|
BufferedReader sin = new BufferedReader(new InputStreamReader(
|
||||||
|
socket.getInputStream(), "ISO-8859-1"));
|
||||||
|
write(out, "EHLO login.hostsharing.net\r\n");
|
||||||
|
String answer = read(sin, "220 ");
|
||||||
|
answer = read(sin, "250-");
|
||||||
|
StringBuffer userPasswd = new StringBuffer();
|
||||||
|
userPasswd.append('\000');
|
||||||
|
userPasswd.append(user);
|
||||||
|
userPasswd.append('\000');
|
||||||
|
userPasswd.append(passwd);
|
||||||
|
write(out, "AUTH PLAIN "
|
||||||
|
+ new String(Base64.encodeBase64(userPasswd.toString().getBytes())) + "\r\n");
|
||||||
|
answer = read(sin, "000");
|
||||||
|
isAuth = answer.startsWith("235");
|
||||||
|
write(out, "QUIT\r\n");
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new SmtpAuthException(e.getMessage());
|
||||||
|
} catch (KeyManagementException e) {
|
||||||
|
throw new SmtpAuthException(e.getMessage());
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new SmtpAuthException(e.getMessage());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new SmtpAuthException(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (socket != null) {
|
||||||
|
try {
|
||||||
|
socket.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(Writer wr, String line) {
|
||||||
|
try {
|
||||||
|
wr.write(line);
|
||||||
|
wr.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String read(BufferedReader rd, String returnCode) {
|
||||||
|
try {
|
||||||
|
String line = rd.readLine();
|
||||||
|
while (line != null && line.startsWith(returnCode)) {
|
||||||
|
line = rd.readLine();
|
||||||
|
}
|
||||||
|
return line;
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SmtpAuthException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2394310295147904537L;
|
||||||
|
|
||||||
|
public SmtpAuthException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SmtpAuthenticator auth = new SmtpAuthenticator();
|
||||||
|
try {
|
||||||
|
if (auth.isAuthenticated(args[0], args[1])) {
|
||||||
|
System.out.println("Login " + args[0] + " Ok");
|
||||||
|
} else {
|
||||||
|
System.out.println("Falsches Login");
|
||||||
|
}
|
||||||
|
} catch (SmtpAuthException e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
authenticator/webapp/WEB-INF/cas.properties
Normal file
11
authenticator/webapp/WEB-INF/cas.properties
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cas.securityContext.serviceProperties.service=http://login.hostsharing.net/cas/services/j_acegi_cas_security_check
|
||||||
|
# Names of roles allowed to access the CAS service manager
|
||||||
|
cas.securityContext.serviceProperties.adminRoles=ROLE_ADMIN
|
||||||
|
cas.securityContext.casProcessingFilterEntryPoint.loginUrl=http://login.hostsharing.net/cas/login
|
||||||
|
cas.securityContext.ticketValidator.casServerUrlPrefix=http://login.hostsharing.net/cas
|
||||||
|
cas.themeResolver.defaultThemeName=hostsharing
|
||||||
|
cas.viewResolver.basename=hostsharing_views
|
||||||
|
host.name=login.hostsharing.net
|
||||||
|
#database.hibernate.dialect=org.hibernate.dialect.OracleDialect
|
||||||
|
#database.hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||||
|
database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
mobile.custom.css.file=css/default-mobile-custom.css
|
||||||
|
standard.custom.css.file=themes/hostsharing/cas.css
|
@ -0,0 +1,38 @@
|
|||||||
|
### Login view (/login)
|
||||||
|
casLoginView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
casLoginView.url=/WEB-INF/view/jsp/hostsharing/ui/casLoginView.jsp
|
||||||
|
|
||||||
|
### Login confirmation view (logged in, warn=true)
|
||||||
|
casLoginConfirmView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
casLoginConfirmView.url=/WEB-INF/view/jsp/hostsharing/ui/casConfirmView.jsp
|
||||||
|
|
||||||
|
### Logged-in view (logged in, no service provided)
|
||||||
|
casLoginGenericSuccessView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
casLoginGenericSuccessView.url=/WEB-INF/view/jsp/hostsharing/ui/casGenericSuccess.jsp
|
||||||
|
|
||||||
|
### Logout view (/logout)
|
||||||
|
casLogoutView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
casLogoutView.url=/WEB-INF/view/jsp/hostsharing/ui/casLogoutView.jsp
|
||||||
|
|
||||||
|
### CAS error view
|
||||||
|
viewServiceErrorView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
viewServiceErrorView.url=/WEB-INF/view/jsp/hostsharing/ui/serviceErrorView.jsp
|
||||||
|
|
||||||
|
viewServiceSsoErrorView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
viewServiceSsoErrorView.url=/WEB-INF/view/jsp/hostsharing/ui/serviceErrorSsoView.jsp
|
||||||
|
|
||||||
|
### Services Management Views
|
||||||
|
addServiceView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
addServiceView.url=/WEB-INF/view/jsp/services/add.jsp
|
||||||
|
|
||||||
|
editServiceView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
editServiceView.url=/WEB-INF/view/jsp/services/add.jsp
|
||||||
|
|
||||||
|
manageServiceView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
manageServiceView.url=/WEB-INF/view/jsp/services/manage.jsp
|
||||||
|
|
||||||
|
serviceLogoutView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
serviceLogoutView.url=/WEB-INF/view/jsp/services/logout.jsp
|
||||||
|
|
||||||
|
viewStatisticsView.(class)=org.springframework.web.servlet.view.JstlView
|
||||||
|
viewStatisticsView.url=/WEB-INF/view/jsp/services/viewStatistics.jsp
|
171
authenticator/webapp/WEB-INF/deployerConfigContext.xml
Normal file
171
authenticator/webapp/WEB-INF/deployerConfigContext.xml
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
| deployerConfigContext.xml centralizes into one file some of the declarative configuration that
|
||||||
|
| all CAS deployers will need to modify.
|
||||||
|
|
|
||||||
|
| This file declares some of the Spring-managed JavaBeans that make up a CAS deployment.
|
||||||
|
| The beans declared in this file are instantiated at context initialization time by the Spring
|
||||||
|
| ContextLoaderListener declared in web.xml. It finds this file because this
|
||||||
|
| file is among those declared in the context parameter "contextConfigLocation".
|
||||||
|
|
|
||||||
|
| By far the most common change you will need to make in this file is to change the last bean
|
||||||
|
| declaration to replace the default SimpleTestUsernamePasswordAuthenticationHandler with
|
||||||
|
| one implementing your approach for authenticating usernames and passwords.
|
||||||
|
+-->
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:p="http://www.springframework.org/schema/p"
|
||||||
|
xmlns:sec="http://www.springframework.org/schema/security"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
|
||||||
|
<!--
|
||||||
|
| This bean declares our AuthenticationManager. The CentralAuthenticationService service bean
|
||||||
|
| declared in applicationContext.xml picks up this AuthenticationManager by reference to its id,
|
||||||
|
| "authenticationManager". Most deployers will be able to use the default AuthenticationManager
|
||||||
|
| implementation and so do not need to change the class of this bean. We include the whole
|
||||||
|
| AuthenticationManager here in the userConfigContext.xml so that you can see the things you will
|
||||||
|
| need to change in context.
|
||||||
|
+-->
|
||||||
|
<bean id="authenticationManager"
|
||||||
|
class="org.jasig.cas.authentication.AuthenticationManagerImpl">
|
||||||
|
<!--
|
||||||
|
| This is the List of CredentialToPrincipalResolvers that identify what Principal is trying to authenticate.
|
||||||
|
| The AuthenticationManagerImpl considers them in order, finding a CredentialToPrincipalResolver which
|
||||||
|
| supports the presented credentials.
|
||||||
|
|
|
||||||
|
| AuthenticationManagerImpl uses these resolvers for two purposes. First, it uses them to identify the Principal
|
||||||
|
| attempting to authenticate to CAS /login . In the default configuration, it is the DefaultCredentialsToPrincipalResolver
|
||||||
|
| that fills this role. If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace
|
||||||
|
| DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are
|
||||||
|
| using.
|
||||||
|
|
|
||||||
|
| Second, AuthenticationManagerImpl uses these resolvers to identify a service requesting a proxy granting ticket.
|
||||||
|
| In the default configuration, it is the HttpBasedServiceCredentialsToPrincipalResolver that serves this purpose.
|
||||||
|
| You will need to change this list if you are identifying services by something more or other than their callback URL.
|
||||||
|
+-->
|
||||||
|
<property name="credentialsToPrincipalResolvers">
|
||||||
|
<list>
|
||||||
|
<!--
|
||||||
|
| UsernamePasswordCredentialsToPrincipalResolver supports the UsernamePasswordCredentials that we use for /login
|
||||||
|
| by default and produces SimplePrincipal instances conveying the username from the credentials.
|
||||||
|
|
|
||||||
|
| If you've changed your LoginFormAction to use credentials other than UsernamePasswordCredentials then you will also
|
||||||
|
| need to change this bean declaration (or add additional declarations) to declare a CredentialsToPrincipalResolver that supports the
|
||||||
|
| Credentials you are using.
|
||||||
|
+-->
|
||||||
|
<bean
|
||||||
|
class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" />
|
||||||
|
<!--
|
||||||
|
| HttpBasedServiceCredentialsToPrincipalResolver supports HttpBasedCredentials. It supports the CAS 2.0 approach of
|
||||||
|
| authenticating services by SSL callback, extracting the callback URL from the Credentials and representing it as a
|
||||||
|
| SimpleService identified by that callback URL.
|
||||||
|
|
|
||||||
|
| If you are representing services by something more or other than an HTTPS URL whereat they are able to
|
||||||
|
| receive a proxy callback, you will need to change this bean declaration (or add additional declarations).
|
||||||
|
+-->
|
||||||
|
<bean
|
||||||
|
class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
| Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate,
|
||||||
|
| AuthenticationHandlers actually authenticate credentials. Here we declare the AuthenticationHandlers that
|
||||||
|
| authenticate the Principals that the CredentialsToPrincipalResolvers identified. CAS will try these handlers in turn
|
||||||
|
| until it finds one that both supports the Credentials presented and succeeds in authenticating.
|
||||||
|
+-->
|
||||||
|
<property name="authenticationHandlers">
|
||||||
|
<list>
|
||||||
|
<!--
|
||||||
|
| This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
|
||||||
|
| a server side SSL certificate.
|
||||||
|
+-->
|
||||||
|
<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
|
||||||
|
p:httpClient-ref="httpClient" />
|
||||||
|
<!--
|
||||||
|
| This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS
|
||||||
|
| into production. The default SimpleTestUsernamePasswordAuthenticationHandler authenticates UsernamePasswordCredentials
|
||||||
|
| where the username equals the password. You will need to replace this with an AuthenticationHandler that implements your
|
||||||
|
| local authentication strategy. You might accomplish this by coding a new such handler and declaring
|
||||||
|
| edu.someschool.its.cas.MySpecialHandler here, or you might use one of the handlers provided in the adaptors modules.
|
||||||
|
+-->
|
||||||
|
<bean
|
||||||
|
class="de.hsadmin.cas.SmtpAuthenticator" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This bean defines the security roles for the Services Management application. Simple deployments can use the in-memory version.
|
||||||
|
More robust deployments will want to use another option, such as the Jdbc version.
|
||||||
|
|
||||||
|
The name of this should remain "userDetailsService" in order for Spring Security to find it.
|
||||||
|
|
||||||
|
To use this, you should add an entry similar to the following between the two value tags:
|
||||||
|
battags=notused,ROLE_ADMIN
|
||||||
|
|
||||||
|
where battags is the username you want to grant access to. You can put one entry per line.
|
||||||
|
-->
|
||||||
|
<!-- <sec:user name="@@THIS SHOULD BE REPLACED@@" password="notused" authorities="ROLE_ADMIN" />-->
|
||||||
|
|
||||||
|
<sec:user-service id="userDetailsService">
|
||||||
|
<sec:user name="pe" password="notused" authorities="ROLE_ADMIN" />
|
||||||
|
</sec:user-service>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Bean that defines the attributes that a service may return. This example uses the Stub/Mock version. A real implementation
|
||||||
|
may go against a database or LDAP server. The id should remain "attributeRepository" though.
|
||||||
|
-->
|
||||||
|
<bean id="attributeRepository"
|
||||||
|
class="org.jasig.services.persondir.support.StubPersonAttributeDao">
|
||||||
|
<property name="backingMap">
|
||||||
|
<map>
|
||||||
|
<entry key="uid" value="uid" />
|
||||||
|
<entry key="eduPersonAffiliation" value="eduPersonAffiliation" />
|
||||||
|
<entry key="groupMembership" value="groupMembership" />
|
||||||
|
</map>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Sample, in-memory data store for the ServiceRegistry. A real implementation
|
||||||
|
would probably want to replace this with the JPA-backed ServiceRegistry DAO
|
||||||
|
The name of this bean should remain "serviceRegistryDao".
|
||||||
|
-->
|
||||||
|
<bean
|
||||||
|
id="serviceRegistryDao"
|
||||||
|
class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
|
||||||
|
<property name="registeredServices">
|
||||||
|
<list>
|
||||||
|
<bean class="org.jasig.cas.services.RegisteredServiceImpl">
|
||||||
|
<property name="id" value="0" />
|
||||||
|
<property name="name" value="HTTP" />
|
||||||
|
<property name="description" value="Only Allows HTTP Urls" />
|
||||||
|
<property name="serviceId" value="http://**" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean class="org.jasig.cas.services.RegisteredServiceImpl">
|
||||||
|
<property name="id" value="1" />
|
||||||
|
<property name="name" value="HTTPS" />
|
||||||
|
<property name="description" value="Only Allows HTTPS Urls" />
|
||||||
|
<property name="serviceId" value="https://**" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean class="org.jasig.cas.services.RegisteredServiceImpl">
|
||||||
|
<property name="id" value="2" />
|
||||||
|
<property name="name" value="IMAPS" />
|
||||||
|
<property name="description" value="Only Allows HTTPS Urls" />
|
||||||
|
<property name="serviceId" value="imaps://**" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean class="org.jasig.cas.services.RegisteredServiceImpl">
|
||||||
|
<property name="id" value="3" />
|
||||||
|
<property name="name" value="IMAP" />
|
||||||
|
<property name="description" value="Only Allows IMAP Urls" />
|
||||||
|
<property name="serviceId" value="imap://**" />
|
||||||
|
</bean>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</beans>
|
@ -0,0 +1,6 @@
|
|||||||
|
<jsp:directive.include file="/WEB-INF/view/jsp/default/ui/includes/top.jsp" />
|
||||||
|
<div id="status" class="errors">
|
||||||
|
<h2><spring:message code="screen.blocked.header" /></h2>
|
||||||
|
<p><spring:message code="screen.blocked.message" /></p>
|
||||||
|
</div>
|
||||||
|
<jsp:directive.include file="/WEB-INF/view/jsp/default/ui/includes/bottom.jsp" />
|
@ -0,0 +1,7 @@
|
|||||||
|
<jsp:directive.include file="includes/top.jsp" />
|
||||||
|
<div class="info"><p>
|
||||||
|
<spring:message
|
||||||
|
code="screen.confirmation.message"
|
||||||
|
arguments="${fn:escapeXml(param.service)}${fn:indexOf(param.service, '?') eq -1 ? '?' : '&'}ticket=${serviceTicketId}" />
|
||||||
|
</p></div>
|
||||||
|
<jsp:directive.include file="includes/bottom.jsp" />
|
@ -0,0 +1,8 @@
|
|||||||
|
<jsp:directive.include file="includes/top.jsp" />
|
||||||
|
<div id="msg" class="success">
|
||||||
|
<h2><spring:message code="screen.success.header" /></h2>
|
||||||
|
<p><spring:message code="screen.success.success" /></p>
|
||||||
|
<p><spring:message code="screen.success.security" /></p>
|
||||||
|
</div>
|
||||||
|
<jsp:directive.include file="includes/bottom.jsp" />
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
|
<jsp:directive.include file="includes/top.jsp" />
|
||||||
|
<form:form method="post" id="fm1" cssClass="fm-v clearfix" commandName="${commandName}" htmlEscape="true">
|
||||||
|
<form:errors path="*" cssClass="errors" id="status" element="div" />
|
||||||
|
<div class="box fl-panel" id="login">
|
||||||
|
<h2>Bitte geben Sie Ihren Benutzernamen und Ihr Passwort ein.</h2>
|
||||||
|
<div class="row fl-controls-left">
|
||||||
|
<label for="username" class="fl-label">Benutzername</label>
|
||||||
|
<c:if test="${not empty sessionScope.openIdLocalId}">
|
||||||
|
<strong>${sessionScope.openIdLocalId}</strong>
|
||||||
|
<input type="hidden" id="username" name="username" value="${sessionScope.openIdLocalId}" />
|
||||||
|
</c:if>
|
||||||
|
<c:if test="${empty sessionScope.openIdLocalId}">
|
||||||
|
<spring:message code="screen.welcome.label.netid.accesskey" var="userNameAccessKey" />
|
||||||
|
<form:input cssClass="required" cssErrorClass="error" id="username" size="25" tabindex="1" accesskey="${userNameAccessKey}" path="username" htmlEscape="true" />
|
||||||
|
</c:if>
|
||||||
|
</div>
|
||||||
|
<div class="row fl-controls-left">
|
||||||
|
<label for="password" class="fl-label">Passwort</label>
|
||||||
|
<spring:message code="screen.welcome.label.password.accesskey" var="passwordAccessKey" />
|
||||||
|
<form:password cssClass="required" cssErrorClass="error" id="password" size="25" tabindex="2" path="password" accesskey="${passwordAccessKey}" htmlEscape="true" />
|
||||||
|
</div>
|
||||||
|
<div class="row btn-row">
|
||||||
|
<input id="warn" name="warn" value="true" type="hidden" />
|
||||||
|
<input type="hidden" name="lt" value="${flowExecutionKey}" />
|
||||||
|
<input type="hidden" name="_eventId" value="submit" />
|
||||||
|
<input class="btn-submit" name="submit" accesskey="l" value="<spring:message code="screen.welcome.button.login" />" tabindex="4" type="submit" />
|
||||||
|
<input class="btn-reset" name="reset" accesskey="c" value="<spring:message code="screen.welcome.button.clear" />" tabindex="5" type="reset" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form:form>
|
||||||
|
<div id="sidebar">
|
||||||
|
</div>
|
||||||
|
<jsp:directive.include file="includes/bottom.jsp" />
|
@ -0,0 +1,7 @@
|
|||||||
|
<jsp:directive.include file="includes/top.jsp" />
|
||||||
|
<div id="msg" class="success">
|
||||||
|
<h2><spring:message code="screen.logout.header" /></h2>
|
||||||
|
<p><spring:message code="screen.logout.success" /></p>
|
||||||
|
<p><spring:message code="screen.logout.security" /></p>
|
||||||
|
</div>
|
||||||
|
<jsp:directive.include file="includes/bottom.jsp" />
|
@ -0,0 +1,7 @@
|
|||||||
|
</div>
|
||||||
|
<div id="footer">
|
||||||
|
<a href="https://www.hostsharing.net/impressum" title="Impressum">Impressum</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,23 @@
|
|||||||
|
<%@ page session="true" %>
|
||||||
|
<%@ page pageEncoding="UTF-8" %>
|
||||||
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||||
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="de">
|
||||||
|
<head>
|
||||||
|
<title>Hostsharing - Central Authentication Service (CAS)</title>
|
||||||
|
<link type="text/css" rel="stylesheet" href="themes/hostsharing/cas.css" />
|
||||||
|
<link rel="icon" href="themes/hostsharing/favicon.ico" type="image/x-icon" />
|
||||||
|
<script type="text/javascript" src="js/common_rosters.js"></script>
|
||||||
|
</head>
|
||||||
|
<body onload="init();">
|
||||||
|
<div id="page">
|
||||||
|
<div id="logo">
|
||||||
|
</div>
|
||||||
|
<div id="header">
|
||||||
|
<h1 id="app-name">Hostsharing - Central Authentication Service (CAS)</h1>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
@ -0,0 +1,13 @@
|
|||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
<jsp:directive.include file="includes/top.jsp" />
|
||||||
|
<c:url var="url" value="/login">
|
||||||
|
<c:param name="service" value="${param.service}" />
|
||||||
|
<c:param name="renew" value="true" />
|
||||||
|
</c:url>
|
||||||
|
<div id="status" class="errors">
|
||||||
|
<h2><spring:message code="screen.service.sso.error.header" /></h2>
|
||||||
|
<p><spring:message code="screen.service.sso.error.message" arguments="${url}" /></p>
|
||||||
|
</div>
|
||||||
|
<jsp:directive.include file="includes/bottom.jsp" />
|
@ -0,0 +1,6 @@
|
|||||||
|
<jsp:directive.include file="includes/top.jsp" />
|
||||||
|
<div id="status" class="errors">
|
||||||
|
<h2><spring:message code="screen.service.error.header" /></h2>
|
||||||
|
<p><spring:message code="screen.service.error.message" /></p>
|
||||||
|
</div>
|
||||||
|
<jsp:directive.include file="includes/bottom.jsp" />
|
358
authenticator/webapp/themes/hostsharing/cas.css
Normal file
358
authenticator/webapp/themes/hostsharing/cas.css
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
html,body {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
border:0;
|
||||||
|
background:transparent;
|
||||||
|
color:#000;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font:normal 76% Arial,Helvetica,Verdana,sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
acronym {
|
||||||
|
border-bottom:1px dotted #ccc;
|
||||||
|
cursor:help;
|
||||||
|
}
|
||||||
|
|
||||||
|
a img,#header img {
|
||||||
|
border:0;
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bold {font-weight:bold;}
|
||||||
|
|
||||||
|
.important {color:#b00;}
|
||||||
|
|
||||||
|
.center {text-align:center;}
|
||||||
|
|
||||||
|
.right {text-align:right;}
|
||||||
|
|
||||||
|
.left {text-align:left;}
|
||||||
|
|
||||||
|
/*************************************** HEADER */
|
||||||
|
#header{
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
width:100%;
|
||||||
|
clear:both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header a {
|
||||||
|
display:block;
|
||||||
|
margin:0;
|
||||||
|
padding:0 0 0 3px;
|
||||||
|
text-decoration:none;
|
||||||
|
background-color:#b00;
|
||||||
|
color:#ffc;
|
||||||
|
font-size:1em;
|
||||||
|
line-height:19px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header a.task {
|
||||||
|
float:right;
|
||||||
|
margin:0 0 0 1px;
|
||||||
|
padding:0 5px 0 20px;
|
||||||
|
line-height:20px;
|
||||||
|
text-decoration:none;
|
||||||
|
color:#ffc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header a:hover.task, #header a:focus.task {background-color:#c33 !important;}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
margin:10px 0 0 5%;
|
||||||
|
padding:0;
|
||||||
|
width:90%;
|
||||||
|
height:80px;
|
||||||
|
clear:both;
|
||||||
|
background: #005094 url(logo.png) no-repeat scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h1 {
|
||||||
|
margin:20px 0 0 5%;
|
||||||
|
padding:0;
|
||||||
|
letter-spacing:1px;
|
||||||
|
background:transparent;
|
||||||
|
font-size:2.0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************** CONTENT */
|
||||||
|
#content {
|
||||||
|
border-top:1px solid #fff; /* REMOVES VERTICAL MARGIN COLLAPSING */
|
||||||
|
margin:0 5%;
|
||||||
|
padding:0;
|
||||||
|
width:auto !important;
|
||||||
|
width /**/:100%;
|
||||||
|
clear:both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content .dataset {
|
||||||
|
margin:30px 0 0 0;
|
||||||
|
padding:10px;
|
||||||
|
border:1px solid #eee;
|
||||||
|
clear:both;
|
||||||
|
width:auto !important;
|
||||||
|
width /**/:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content .dataset h2 {
|
||||||
|
position:relative;
|
||||||
|
top:-20px;
|
||||||
|
left:-20px;
|
||||||
|
width:350px;
|
||||||
|
margin:0;
|
||||||
|
padding:0 0 1px 5px;
|
||||||
|
border:1px solid #ccc;
|
||||||
|
background-color:#eee;
|
||||||
|
color:#066;
|
||||||
|
font-weight:bold;
|
||||||
|
font-size:1em;
|
||||||
|
line-height:1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content .dataset .leftCol {
|
||||||
|
float:left;
|
||||||
|
width:50%;
|
||||||
|
min-width:50%;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#appStatus .dataset .rightCol {
|
||||||
|
float:right;
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
html>body .clear:after {
|
||||||
|
content:" ";
|
||||||
|
display:block;
|
||||||
|
height:0px;
|
||||||
|
line-height:0px;
|
||||||
|
clear:both;
|
||||||
|
visibility:hidden; /* HIDES THE ELEMENT, BUT STILL TAKES UP SPACE */
|
||||||
|
}
|
||||||
|
|
||||||
|
#content p {
|
||||||
|
line-height:1.6em;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#content ul {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content ul li {
|
||||||
|
padding-left:20px;
|
||||||
|
margin-top:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content h2 {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
font-size:1.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content h3 {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
font-size:1.5em;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content p.top {
|
||||||
|
text-align:right;
|
||||||
|
font:bold 1em Verdana,Helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************** FOOTER */
|
||||||
|
#footer {
|
||||||
|
margin:2em 5% 10px 5%;
|
||||||
|
padding:0;
|
||||||
|
clear:both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer hr {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
height:1px;
|
||||||
|
background:#ccc;
|
||||||
|
color:#ccc;
|
||||||
|
border:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer p {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
font-size:1em;
|
||||||
|
line-height:1.2em;
|
||||||
|
color:#999;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer p#copyright {margin-top:1em;}
|
||||||
|
|
||||||
|
/*************************************** LINK STYLES */
|
||||||
|
#content a:hover, #content a:focus, #content ul li a:hover, #content ul li a:focus,
|
||||||
|
#menu ul li a:hover, #menu ul li a:focus,
|
||||||
|
#footer a:hover, #footer a:focus {
|
||||||
|
background:transparent;
|
||||||
|
color:#b00;
|
||||||
|
text-decoration:underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************** TABLE FORMATTING */
|
||||||
|
table {
|
||||||
|
border-right:solid 1px #999;
|
||||||
|
border-bottom:solid 1px #999;
|
||||||
|
background-color:#fff;
|
||||||
|
font-size:1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
border-left:solid 1px #ccc;
|
||||||
|
border-top:solid 1px #ccc;
|
||||||
|
background-color:#eee;
|
||||||
|
color:#066;
|
||||||
|
font-weight:normal;
|
||||||
|
font-size:1em;
|
||||||
|
vertical-align:middle;
|
||||||
|
text-align:left;
|
||||||
|
padding:0 0 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-left:solid 1px #ccc;
|
||||||
|
border-top:solid 1px #ccc;
|
||||||
|
font-size:1em;
|
||||||
|
padding:0 0 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************** FORMS */
|
||||||
|
form {display:inline;}
|
||||||
|
|
||||||
|
input:focus, textarea:focus, select:focus {background:#fc3 !important;}
|
||||||
|
|
||||||
|
input.numeric {text-align:right;}
|
||||||
|
|
||||||
|
/*************************************** BUTTON STYLES */
|
||||||
|
#content a.button, #content a.button:link, #content a.button:hover, #content a.button:active, #content .button {
|
||||||
|
text-decoration:none;
|
||||||
|
background-color:#d0d0d0;
|
||||||
|
border:1px outset #d0d0d0;
|
||||||
|
color: #000;
|
||||||
|
padding:1px 1em;
|
||||||
|
font-size:1.2em;
|
||||||
|
line-height:1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************** HELP */
|
||||||
|
#help {
|
||||||
|
background-color:#ffc;
|
||||||
|
border:1px solid #ccc;
|
||||||
|
margin:0 0 15px 0;
|
||||||
|
padding:0 0 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#help h4 {
|
||||||
|
margin:0 0 10px 0;
|
||||||
|
border-bottom:1px solid #ccc;
|
||||||
|
background-color:#fc3;
|
||||||
|
color:#b00;
|
||||||
|
font-size:1em;
|
||||||
|
font-weight:bold;
|
||||||
|
line-height:19px;
|
||||||
|
padding:0 0 0 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#help p {
|
||||||
|
margin:10px;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #help #closeHelp {display:none;} */
|
||||||
|
|
||||||
|
#help h4 a, #help h4 a:visited {
|
||||||
|
float:right;
|
||||||
|
margin:0;
|
||||||
|
padding:0 5px 0 20px;
|
||||||
|
text-decoration:none !important;
|
||||||
|
color:#ffc !important;
|
||||||
|
font-weight:normal;
|
||||||
|
line-height:19px;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border-top:solid 1px #ccc;
|
||||||
|
border-bottom:0;
|
||||||
|
border-right:0;
|
||||||
|
border-left:0;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
padding-bottom: 1.5em;
|
||||||
|
}
|
||||||
|
form{
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.accesskey {text-decoration:underline;}
|
||||||
|
fieldset div {padding-top:10px;}
|
||||||
|
|
||||||
|
legend {color:#066;}
|
||||||
|
|
||||||
|
input, select,textarea {
|
||||||
|
font-family:monospace;
|
||||||
|
font-size:11px;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content .button {
|
||||||
|
padding:3px 0px;
|
||||||
|
font-size:11px;
|
||||||
|
width:11em;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
margin:0 5px 0 0;
|
||||||
|
font-weight:bold;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.required {background:#ffc;}
|
||||||
|
.important {color:#b00;font-family:monospace;font-weight:bold;font-size:1.2em;}
|
||||||
|
.evenrow {background-color:#eee;}
|
||||||
|
|
||||||
|
table .appHeadingRow th {
|
||||||
|
border-top:5px solid #ccc;
|
||||||
|
background-color:#666;
|
||||||
|
color:#fff;
|
||||||
|
text-align:left;
|
||||||
|
padding:0 0 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#login {float:left; margin:0 -296px 0 0; padding:15px; width:258px; min-height:15em; background:#eee; position:relative; border:0;}
|
||||||
|
#login h2 {border-bottom:1px solid #ddd; padding:3px 0; font:normal 400 17px Georgia, "Times New Roman", Times, serif; color:#333;}
|
||||||
|
#login label {font-size:11px;}
|
||||||
|
#login label span.accesskey {text-decoration:underline;}
|
||||||
|
#login input {letter-spacing:1px;}
|
||||||
|
#login .check input {position:relative; left:-4px; height:auto;}
|
||||||
|
#login .check label {float:none; xwidth:auto; line-height:1.8;}
|
||||||
|
#login .btn-row {position:relative; top:15px; padding-top:10px; border-top:1px solid #ddd;}
|
||||||
|
#login .btn-row {top:5px;} /* IE6 */
|
||||||
|
#login .btn-submit {float:none; clear:none; display:inline; letter-spacing:0;}
|
||||||
|
#login .btn-submit {background:#ffd;}
|
||||||
|
#login .btn-reset {float:none; clear:none; margin-left:5px; border:0; border-left:1px solid #ddd; background:transparent; color:#777; text-transform:lowercase; letter-spacing:0;}
|
||||||
|
|
||||||
|
/* MESSAGES --------------------------------- */
|
||||||
|
.info, .errors, .success {clear:both; margin:18px 0; padding:20px 20px 20px 100px; font-size:10px; line-height:1.5;}
|
||||||
|
#content .errors h2, #content .success h2 {font-family:Arial,Helvetica,Verdana,sans-serif; font-size:18px; line-height:48px; font-weight:400; margin:0 18px 0 0; padding:0;}
|
||||||
|
#content .success h2 {color: #008 !important;}
|
||||||
|
#content .errors h2 {color:#b00 !important;}
|
||||||
|
#content .success h2 {color:#060 !important;}
|
||||||
|
|
||||||
|
|
||||||
|
/* static messages */
|
||||||
|
#content #msg p {padding:0;}
|
BIN
authenticator/webapp/themes/hostsharing/favicon.ico
Normal file
BIN
authenticator/webapp/themes/hostsharing/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
authenticator/webapp/themes/hostsharing/logo.png
Normal file
BIN
authenticator/webapp/themes/hostsharing/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
1
hsacppcli/.gitignore
vendored
Normal file
1
hsacppcli/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
70
hsacppcli/Makefile
Normal file
70
hsacppcli/Makefile
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#
|
||||||
|
# (c) okunah gmbh
|
||||||
|
#
|
||||||
|
# name: Makefile
|
||||||
|
#
|
||||||
|
# description: description
|
||||||
|
#
|
||||||
|
# written by: Christof Donat
|
||||||
|
#
|
||||||
|
# changes:
|
||||||
|
# 05.11.11 (Christof Donat): created this file
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# includes
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# defines
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# rules
|
||||||
|
#
|
||||||
|
|
||||||
|
all: release
|
||||||
|
|
||||||
|
debug-test: debug
|
||||||
|
cd build/Debug; make test
|
||||||
|
|
||||||
|
debug: debug-env
|
||||||
|
cd build/Debug; make
|
||||||
|
|
||||||
|
debug-dir:
|
||||||
|
if [ ! -d build/Debug ]; then mkdir -p build/Debug; fi
|
||||||
|
|
||||||
|
debug-env: debug-dir
|
||||||
|
cd build/Debug; cmake -DCMAKE_BUILD_TYPE="Debug" ../../hsadminc/
|
||||||
|
|
||||||
|
test: release
|
||||||
|
cd build/Release; make test
|
||||||
|
|
||||||
|
release: release-env
|
||||||
|
cd build/Release; make
|
||||||
|
|
||||||
|
release-env: release-dir
|
||||||
|
cd build/Release; cmake -DCMAKE_BUILD_TYPE="Release" ../../hsadminc/
|
||||||
|
|
||||||
|
release-dir:
|
||||||
|
if [ ! -d build/Release ]; then mkdir -p build/Release; fi
|
||||||
|
|
||||||
|
small-test: small
|
||||||
|
cd build/MinSizeRel; make test
|
||||||
|
|
||||||
|
small: small-env
|
||||||
|
cd build/MinSizeRel; make
|
||||||
|
|
||||||
|
small-env: small-dir
|
||||||
|
cd build/MinSizeRel; cmake -DCMAKE_BUILD_TYPE="MinSizeRel" ../../hsadminc/
|
||||||
|
|
||||||
|
small-dir:
|
||||||
|
if [ ! -d build/MinSizeRel ]; then mkdir -p build/MinSizeRel; fi
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
|
# end Makefile
|
||||||
|
|
||||||
|
|
129
hsacppcli/hsadminc/CMakeLists.txt
Normal file
129
hsacppcli/hsadminc/CMakeLists.txt
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
PROJECT( hsadminc )
|
||||||
|
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
|
||||||
|
|
||||||
|
#
|
||||||
|
# look for packages needed for the build to succeed
|
||||||
|
#
|
||||||
|
|
||||||
|
# find boost libraries
|
||||||
|
SET(Boost_USE_MULTITHREADED ON)
|
||||||
|
SET(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
FIND_PACKAGE( Boost 1.44 REQUIRED COMPONENTS date_time filesystem iostreams regex system unit_test_framework thread )
|
||||||
|
|
||||||
|
# find doxygen
|
||||||
|
FIND_PACKAGE( Doxygen 1.7.3 )
|
||||||
|
|
||||||
|
# find GnuTLS
|
||||||
|
FIND_PACKAGE( GnuTLS 2.8.6 REQUIRED )
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# set compiler and linker flags
|
||||||
|
#
|
||||||
|
|
||||||
|
# compiler
|
||||||
|
SET( CMAKE_CXX_FLAGS_DEBUG "-g3 -O0" )
|
||||||
|
SET( CMAKE_CXX_FLAGS_RELEASE "-O3" )
|
||||||
|
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g3 -O3" )
|
||||||
|
SET( CMAKE_CXX_FLAGS_MINSIZEREL "-Os" )
|
||||||
|
|
||||||
|
# gcc specific
|
||||||
|
IF( CMAKE_COMPILER_IS_GNUCC )
|
||||||
|
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wold-style-cast -pedantic -Wall -Wextra -Winit-self -Wshadow -Wconversion -Wlogical-op -Wnormalized=nfc -Winline -std=c++0x" )
|
||||||
|
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++0x" )
|
||||||
|
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++0x" )
|
||||||
|
SET( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -std=c++0x" )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
#linker
|
||||||
|
SET( CMAKE_LINK_FLAGS_DEBUG "-g -O0" )
|
||||||
|
SET( CMAKE_LINK_FLAGS_RELEASE "-O3" )
|
||||||
|
SET( CMAKE_LINK_FLAGS_RELWITHDEBINFO "-g -O3" )
|
||||||
|
SET( CMAKE_LINK_FLAGS_MINSIZEREL "-O3" )
|
||||||
|
|
||||||
|
# GNU ld specific
|
||||||
|
IF( CMAKE_COMPILER_IS_GNUCC )
|
||||||
|
SET( CMAKE_LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_RELEASE} --relax" )
|
||||||
|
SET( CMAKE_LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE} --relax" )
|
||||||
|
SET( CMAKE_LINK_FLAGS_RELWITHDEBINFO "${CMAKE_LINK_FLAGS_RELWITHDEBINFO} --relax" )
|
||||||
|
SET( CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} -s --gc-sections --relax" )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# build the release as default
|
||||||
|
SET( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_RELEASE} )
|
||||||
|
SET( CMAKE_LINK_FLAGS ${CMAKE_LINK_FLAGS_RELEASE} )
|
||||||
|
|
||||||
|
# make sure the boost include files are available
|
||||||
|
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
|
||||||
|
# all libs that will be linked to hsadminc
|
||||||
|
SET( HSADMINC_LIB ${Boost_LIBRARIES} gnutls )
|
||||||
|
|
||||||
|
# now this is where the source is
|
||||||
|
ADD_SUBDIRECTORY( source )
|
||||||
|
|
||||||
|
# packaging
|
||||||
|
IF( ${UNIX} )
|
||||||
|
SET( CPACK_GNERATOR "DEB;RPM;" )
|
||||||
|
SET( CPACK_PACKAGE_DESCRIPTION "hsadmin command line client" )
|
||||||
|
SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY "a command line tool to access servers of the configuration tool hsadmin developed by Hostsharing e.G." )
|
||||||
|
SET( CPACK_PACKAGE_NAME "hsadminc" )
|
||||||
|
|
||||||
|
SET( CPACK_DEBIAN_PACKAGE_DEPENDS "boost (>= 1.44), gnutls (>= 2.8.6)" )
|
||||||
|
SET( CPACK_PACKAGE_CONTACT "Christof Donat" )
|
||||||
|
SET( CPACK_PACKAGE_VENDOR "Hostsharing e.G." )
|
||||||
|
SET( CPACK_PACKAGE_VERSION_MAJOR "0" )
|
||||||
|
SET( CPACK_PACKAGE_VERSION_MINOR "0" )
|
||||||
|
SET( CPACK_PACKAGE_VERSION_PATCH "1" )
|
||||||
|
SET( VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# currently WIN32 is not supported
|
||||||
|
#IF( ${WIN32} )
|
||||||
|
# SET( CPACK_GNERATOR "NSIS;" )
|
||||||
|
# SET( CPACK_NSIS_MUI_ICON "" )
|
||||||
|
# SET( CPACK_NSIS_MUI_UNIICON "" )
|
||||||
|
# SET( CPACK_PACKAGE_ICON "" )
|
||||||
|
# SET( CPACK_NSIS_EXTRA_INSTALL_COMMANDS "" )
|
||||||
|
# SET( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "" )
|
||||||
|
# SET( CPACK_NSIS_COMPRESSOR "" )
|
||||||
|
# SET( CPACK_NSIS_MODIFY_PATH "" )
|
||||||
|
# SET( CPACK_NSIS_DISPLAY_NAME "" )
|
||||||
|
# SET( CPACK_NSIS_INSTALLED_ICON_NAME "" )
|
||||||
|
# SET( CPACK_NSIS_HELP_LINK "" )
|
||||||
|
# SET( CPACK_NSIS_URL_INFO_ABOUT "" )
|
||||||
|
# SET( CPACK_NSIS_CONTACT "" )
|
||||||
|
# SET( CPACK_NSIS_CREATE_ICONS_EXTRA "" )
|
||||||
|
# SET( CPACK_NSIS_DELETE_ICONS_EXTRA "" )
|
||||||
|
# SET( CPACK_NSIS_MENU_LINKS "" )
|
||||||
|
# SET( CPACK_NSIS_MUI_FINISHPAGE_RUN "" )
|
||||||
|
#ENDIF()
|
||||||
|
|
||||||
|
# currently OSX is not supported
|
||||||
|
#IF( ${APPLE} )
|
||||||
|
# SET( CPACK_GNERATOR "MACOSX_BUNDLE;" )
|
||||||
|
# SET( CPACK_PACKAGE_FILE_NAME "" )
|
||||||
|
# SET( CPACK_PACKAGE_ICON "" )
|
||||||
|
# SET( CPACK_BUNDLE_NAME "" )
|
||||||
|
# SET( CPACK_BUNDLE_ICON "" )
|
||||||
|
# SET( CPACK_BUNDLE_PLIST "" )
|
||||||
|
# SET( CPACK_BUNDLE_STARTUP_COMMAND "" )
|
||||||
|
#ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# doxygen documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
CONFIGURE_FILE( doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
|
||||||
|
ADD_CUSTOM_TARGET( doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
|
||||||
|
SET_PROPERTY( DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CKEAN_FILES doc )
|
||||||
|
GET_TARGET_PROPERTY( DOC_TARGET doc TYPE )
|
||||||
|
IF( NOT DOC_TARGET )
|
||||||
|
ADD_CUSTOM_TARGET( doc )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ADD_DEPENDENCIES( doc doxygen )
|
||||||
|
|
||||||
|
SET( DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}" )
|
||||||
|
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION DOC_PATH )
|
||||||
|
|
1679
hsacppcli/hsadminc/doc/Doxyfile.in
Normal file
1679
hsacppcli/hsadminc/doc/Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
BIN
hsacppcli/hsadminc/doc/logo.png
Normal file
BIN
hsacppcli/hsadminc/doc/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
11
hsacppcli/hsadminc/source/CMakeLists.txt
Normal file
11
hsacppcli/hsadminc/source/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
|
|
||||||
|
SET( HSADMINC_SRC abstractcmdlineparser.cpp cmdlineparser.cpp configfile.cpp hsadminc.cpp httpclient.cpp logger.cpp sslclient.cpp transaction.cpp xmlparser.cpp )
|
||||||
|
|
||||||
|
ADD_EXECUTABLE( hsadminc ${HSADMINC_SRC} )
|
||||||
|
TARGET_LINK_LIBRARIES( hsadminc ${HSADMINC_LIB} )
|
||||||
|
|
||||||
|
INSTALL( TARGETS hsadminc RUNTIME DESTINATION bin )
|
||||||
|
|
22
hsacppcli/hsadminc/source/abstractcmdlineparser.cpp
Normal file
22
hsacppcli/hsadminc/source/abstractcmdlineparser.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "abstractcmdlineparser.h"
|
||||||
|
|
417
hsacppcli/hsadminc/source/abstractcmdlineparser.h
Normal file
417
hsacppcli/hsadminc/source/abstractcmdlineparser.h
Normal file
@ -0,0 +1,417 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include "logger.h"
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
/** abstractcommandlineparser holds some basic stuff for making commandline-Parsers easier. */
|
||||||
|
|
||||||
|
namespace abstractcommandlineparser {
|
||||||
|
|
||||||
|
#ifndef HSADMIN_ABSTRACTCMDLINEPARSER
|
||||||
|
#define HSADMIN_ABSTRACTCMDLINEPARSER
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::string;
|
||||||
|
using boost::shared_ptr;
|
||||||
|
using boost::scoped_ptr;
|
||||||
|
using boost::starts_with;
|
||||||
|
using boost::erase_first;
|
||||||
|
|
||||||
|
/** \brief template for Commandline-Parser
|
||||||
|
*
|
||||||
|
* Has two Parameters:
|
||||||
|
* - class Options: This class must provide a method 'parseThis()'. - see template CmdLineOption for an example
|
||||||
|
* - class parseResult: a shared pointer to an Object of this class is passed to the Options.
|
||||||
|
*/
|
||||||
|
template<class Options,class parserResult> class CmdLineParser {
|
||||||
|
public:
|
||||||
|
/** \brief this actually not only instatiates the parser but also parses Parameters.
|
||||||
|
*
|
||||||
|
* takes the Options in a vector<string>
|
||||||
|
*/
|
||||||
|
CmdLineParser(vector<string> options) : m_parsed(new parserResult), m_parseSuccessful(false) {
|
||||||
|
Options o;
|
||||||
|
while( options.size() > 0 )
|
||||||
|
if( !(this->m_parseSuccessful = o.parseThis(options,m_parsed)) )
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! has the parser been successful?
|
||||||
|
inline bool operator!() { return !this->m_parseSuccessful; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
shared_ptr<parserResult> m_parsed;
|
||||||
|
bool m_parseSuccessful;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief base template for Option classes
|
||||||
|
*
|
||||||
|
* usually you would use one of the many specialisations
|
||||||
|
* has four parameters:
|
||||||
|
* - bool hasLongName: the Parameter has a long name (e.g. --verbose)
|
||||||
|
* - bool hasShortName: the Parameter has a short name (e.g. -v)
|
||||||
|
* - bool hasParameter: the Parameter is followed by another Parameter that belongs to it
|
||||||
|
* - class parseResult: takes the Parse results
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method 'bool handle(string ¶meter, shared_ptr<parseResult> result)'
|
||||||
|
* if you have 'hasParameter' set to true or 'bool handle(shared_ptr<parseResult> result)' otherwise. There you
|
||||||
|
* can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <bool hasLongName, bool hasShortName, bool hasParameter,class parseResult> class CmdLineOption {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that do have long and short names as well as a value.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(string ¶meter, shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<true, true, true,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( starts_with(options[0], "-"+m_shortName) ) {
|
||||||
|
if( rval = this->handle(options[1],result) ) {
|
||||||
|
if( options[0] == "-"+m_shortName)
|
||||||
|
options.erase(options.begin(),options.begin()+2);
|
||||||
|
else {
|
||||||
|
options.erase(options.begin()+1);
|
||||||
|
erase_first(options[0], m_shortName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if( starts_with(options[0], "--"+m_longName+m_parameterSeparator) ) {
|
||||||
|
string p = options[0].substr(m_longName.size()+m_parameterSeparator.size()+2);
|
||||||
|
if( rval = this->handle(p,result) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string m_longName;
|
||||||
|
string m_shortName;
|
||||||
|
string m_parameterSeparator;
|
||||||
|
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that do have long and short names but no value.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<true, true, false,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( options[0] == "-"+m_shortName || options[0] == "--"+m_longName ) {
|
||||||
|
if( rval = this->handle(result) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
} else if( starts_with(options[0], "-"+m_shortName) && (rval = this->handle(result)) )
|
||||||
|
erase_first(options[0], m_shortName);
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string m_longName;
|
||||||
|
string m_shortName;
|
||||||
|
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that only have a long name and a value but no short name.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(string ¶meter, shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<true, false, true,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( starts_with(options[0], "--"+m_longName+m_parameterSeparator) ) {
|
||||||
|
string p = options[0].substr(m_longName.size()+m_parameterSeparator.size()+2);
|
||||||
|
if ( rval = this->handle(p, result) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string m_longName;
|
||||||
|
string m_parameterSeparator;
|
||||||
|
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that only have a long name but no value or short name.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<true, false, false,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( options[0] == "--"+m_longName && (rval = this->handle(result)) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string m_longName;
|
||||||
|
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that only have short name and a value but no long name.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(string ¶meter, shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<false, true, true,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( starts_with(options[0], "-"+m_shortName) && (rval = this->handle(options[1],result)) ) {
|
||||||
|
if( options[0] == "-"+m_shortName)
|
||||||
|
options.erase(options.begin(),options.begin()+2);
|
||||||
|
else {
|
||||||
|
options.erase(options.begin()+1);
|
||||||
|
erase_first(options[0], m_shortName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string m_shortName;
|
||||||
|
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that only have short name bot no value or long name.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<false, true, false,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( starts_with(options[0], "-"+m_shortName) && (rval = this->handle(result)) ) {
|
||||||
|
if( options[0] == "-"+m_shortName )
|
||||||
|
options.erase(options.begin());
|
||||||
|
else
|
||||||
|
erase_first(options[0], m_shortName);
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string m_shortName;
|
||||||
|
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that only have a value but neither a long or short name.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(string ¶meter, shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<false, false, true,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( !starts_with(options[0], "-") && (rval = this->handle(options[0],result)) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief base template for Option classes - specialisation
|
||||||
|
*
|
||||||
|
* this is the specialisation for Parameters that neither have a value, a long or short name.
|
||||||
|
*
|
||||||
|
* You should implement a protected virtual method
|
||||||
|
* 'bool handle(shared_ptr<parseResult> result)'.
|
||||||
|
* There you can actually store your values in your parseResult.
|
||||||
|
*/
|
||||||
|
template <class parseResult> class CmdLineOption<false, false, false,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( !starts_with(options[0], "-") && (rval = this->handle(result)) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! the handle function.
|
||||||
|
virtual bool handle(shared_ptr<parseResult> result) { return true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
//! just needed for typelists
|
||||||
|
class nullType {};
|
||||||
|
|
||||||
|
//! typelist for multiple Options parser
|
||||||
|
template<class CAR, class CDR> class typelist {
|
||||||
|
public:
|
||||||
|
typedef CAR car;
|
||||||
|
typedef CDR cdr;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief A Commandline-Option for CmdLineParser that works with a typelist of Options.
|
||||||
|
*
|
||||||
|
* this is meant to combine multiple Parameters in a typelist to build a complex Command Line parser
|
||||||
|
*/
|
||||||
|
template<class tl, class parseResult> class CmdLineOptionList : public CmdLineOption<false,false,false,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
return m_first.parseThis(options,result) || m_second.parseThis(options,result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
typename tl::car m_first;
|
||||||
|
CmdLineOptionList<typename tl::cdr,parseResult> m_second;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief specialisation for empty type list
|
||||||
|
*/
|
||||||
|
template<class parseResult> class CmdLineOptionList<nullType,parseResult> : public CmdLineOption<false,false,false,parseResult> {
|
||||||
|
public:
|
||||||
|
//! the actual parser function; always returns false.
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parseResult> result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define Parameterlist1(t1) \
|
||||||
|
abstractcommandlineparser::typelist<t1,abstractcommandlineparser::nullType>
|
||||||
|
#define Parameterlist2(t1,t2) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist1(t2) >
|
||||||
|
#define Parameterlist3(t1,t2,t3) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist2(t2,t3) >
|
||||||
|
#define Parameterlist4(t1,t2,t3,t4) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist3(t2,t3,t4) >
|
||||||
|
#define Parameterlist5(t1,t2,t3,t4,t5) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist4(t2,t3,t4,t5) >
|
||||||
|
#define Parameterlist6(t1,t2,t3,t4,t5,t6) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist5(t2,t3,t4,t5,t6) >
|
||||||
|
#define Parameterlist7(t1,t2,t3,t4,t5,t6,t7) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist6(t2,t3,t4,t5,t6,t7) >
|
||||||
|
#define Parameterlist8(t1,t2,t3,t4,t5,t6,t7,t8) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist7(t2,t3,t4,t5,t6,t7,t8) >
|
||||||
|
#define Parameterlist9(t1,t2,t3,t4,t5,t6,t7,t8,t9) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist8(t2,t3,t4,t5,t6,t7,t8,t9) >
|
||||||
|
#define Parameterlist10(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist9(t2,t3,t4,t5,t6,t7,t8,t9,t10) >
|
||||||
|
#define Parameterlist11(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist10(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11) >
|
||||||
|
#define Parameterlist12(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist11(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12) >
|
||||||
|
#define Parameterlist13(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist12(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13) >
|
||||||
|
#define Parameterlist14(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist13(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14) >
|
||||||
|
#define Parameterlist15(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist14(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15) >
|
||||||
|
#define Parameterlist16(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist15(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16) >
|
||||||
|
#define Parameterlist17(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist16(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17) >
|
||||||
|
#define Parameterlist18(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist17(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18) >
|
||||||
|
#define Parameterlist19(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist18(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19) >
|
||||||
|
#define Parameterlist20(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist19(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20) >
|
||||||
|
#define Parameterlist21(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist20(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21) >
|
||||||
|
#define Parameterlist22(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist21(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22) >
|
||||||
|
#define Parameterlist23(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist22(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23) >
|
||||||
|
#define Parameterlist24(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24) \
|
||||||
|
abstractcommandlineparser::typelist<t1,Parameterlist23(t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24) >
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
template<class Options,class parseResult> class CmdLineParser;
|
||||||
|
template <bool hasLongName, bool hasShortName, bool hasParameter,class parseResult> class CmdLineOption;
|
||||||
|
class nullType;
|
||||||
|
template<class CAR, class CDR> class typelist;
|
||||||
|
template<class tl, class parseResult> class CmdLineOptionList;
|
||||||
|
|
||||||
|
#endif /* HSADMIN_ABSTRACTCMDLINEPARSER */
|
||||||
|
};
|
772
hsacppcli/hsadminc/source/cmdlineparser.cpp
Normal file
772
hsacppcli/hsadminc/source/cmdlineparser.cpp
Normal file
@ -0,0 +1,772 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "cmdlineparser.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
#include <termios.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
namespace commandline {
|
||||||
|
|
||||||
|
using std::cout;
|
||||||
|
using std::cin;
|
||||||
|
using std::flush;
|
||||||
|
using std::ifstream;
|
||||||
|
using std::ostringstream;
|
||||||
|
|
||||||
|
using boost::lexical_cast;
|
||||||
|
using boost::bad_lexical_cast;
|
||||||
|
using boost::shared_ptr;
|
||||||
|
using boost::scoped_ptr;
|
||||||
|
using boost::starts_with;
|
||||||
|
using boost::erase_first;
|
||||||
|
|
||||||
|
// dynamic cast needs this
|
||||||
|
|
||||||
|
vector<string> callParameter::parseDisplayspec() {
|
||||||
|
vector<string> rval;
|
||||||
|
boost::regex pattern("\\$\\{([^\\}]*)\\}");
|
||||||
|
boost::sregex_iterator end;
|
||||||
|
|
||||||
|
for(boost::sregex_iterator i(this->m_display.begin(),this->m_display.end(),pattern); i != end; i++ )
|
||||||
|
rval.insert(rval.end(),(*i)[1]);
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"have parsed displayspec Parameter '"+this->m_display+"'");
|
||||||
|
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
string callParameter::evalDisplay(const map<string, string> &values) {
|
||||||
|
string rval = this->m_display;
|
||||||
|
string::size_type pos;
|
||||||
|
|
||||||
|
for( map<string,string>::const_iterator i = values.begin(); i != values.end(); i++ ) {
|
||||||
|
string pattstring = "${"+i->first+"}";
|
||||||
|
while( (pos = rval.find(pattstring,0)) != string::npos ) rval.replace(pos,pattstring.length(),i->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
while( (pos = rval.find("\\n",0)) != string::npos ) rval.replace(pos,2,"\n");
|
||||||
|
while( (pos = rval.find("\\t",0)) != string::npos ) rval.replace(pos,2,"\t");
|
||||||
|
while( (pos = rval.find("\\r",0)) != string::npos ) rval.replace(pos,2,"\r");
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"have evaluated displayspec Parameter '"+this->m_display+"': '"+rval+"'");
|
||||||
|
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
string setParameter::toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile) {
|
||||||
|
string rpccall = "<struct>";
|
||||||
|
rpccall += "<member><name>property</name><value>"+m_property+"</value></member>";
|
||||||
|
rpccall += "<member><name>value</name><value>"+m_value+"</value></member>";
|
||||||
|
rpccall += "</struct>";
|
||||||
|
return rpccall;
|
||||||
|
}
|
||||||
|
string whereParameter::toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile) {
|
||||||
|
string rpccall = "<struct>";
|
||||||
|
rpccall += "<member><name>property</name><value>"+m_property+"</value></member>";
|
||||||
|
rpccall += "<member><name>value</name><value>"+m_pattern+"</value></member>";
|
||||||
|
rpccall += "</struct>";
|
||||||
|
return rpccall;
|
||||||
|
}
|
||||||
|
string orderParameter::toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile) {
|
||||||
|
string rpccall = "<struct>";
|
||||||
|
rpccall += "<member><name>property</name><value>"+m_property+"</value></member>";
|
||||||
|
rpccall += "<member><name>ascending</name><value><boolean>";
|
||||||
|
rpccall += string((m_ascending?"1":"0"))+"</boolean></value></member>";
|
||||||
|
rpccall += "</struct>";
|
||||||
|
return rpccall;
|
||||||
|
}
|
||||||
|
string callParameter::toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile) {
|
||||||
|
string rpccall = "<struct>";
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>module</name>";
|
||||||
|
rpccall += "<value>"+m_module+"</value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>function</name>";
|
||||||
|
rpccall += "<value>"+m_function+"</value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
|
||||||
|
if( m_force ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>force</name>";
|
||||||
|
rpccall += "<value><boolean>1</boolean></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
if( m_ignoreerror ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>ignoreerror</name>";
|
||||||
|
rpccall += "<value><boolean>1</boolean></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
vector<string> reads = parseDisplayspec();
|
||||||
|
|
||||||
|
if(reads.size()) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>read</name>";
|
||||||
|
rpccall += "<value><array><data>";
|
||||||
|
for(vector<string>::iterator j = reads.begin(); j != reads.end(); j++ )
|
||||||
|
rpccall += "<value>"+(*j)+"</value>";
|
||||||
|
rpccall += "</data></array></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_where.size() ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>where</name>";
|
||||||
|
rpccall += "<value><array><data>";
|
||||||
|
for(vector<shared_ptr<whereParameter> >::iterator j = m_where.begin(); j != m_where.end(); j++ )
|
||||||
|
rpccall += "<value>"+((*j)->toXML(username,cfgfile))+"</value>";
|
||||||
|
rpccall += "</data></array></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_set.size() ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>set</name>";
|
||||||
|
rpccall += "<value><array><data>";
|
||||||
|
for(vector<shared_ptr<setParameter> >::iterator j = m_set.begin(); j != m_set.end(); j++ )
|
||||||
|
rpccall += "<value>"+((*j)->toXML(username,cfgfile))+"</value>";
|
||||||
|
rpccall += "</data></array></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_order.size() ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>order</name>";
|
||||||
|
rpccall += "<value><array><data>";
|
||||||
|
for(vector<shared_ptr<orderParameter> >::iterator j = m_order.begin(); j != m_order.end(); j++ )
|
||||||
|
rpccall += "<value>"+((*j)->toXML(username,cfgfile))+"</value>";
|
||||||
|
rpccall += "</data></array></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_objects.size() ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>objectid</name>";
|
||||||
|
rpccall += "<value><array><data>";
|
||||||
|
for(vector<string>::iterator j = m_objects.begin(); j != m_objects.end(); j++ )
|
||||||
|
rpccall += "<value>"+(*j)+"</value>";
|
||||||
|
rpccall += "</data></array></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_unset.size() ) {
|
||||||
|
rpccall += "<member>";
|
||||||
|
rpccall += "<name>unset</name>";
|
||||||
|
rpccall += "<value><array><data>";
|
||||||
|
for(vector<string>::iterator j = m_unset.begin(); j != m_unset.end(); j++ )
|
||||||
|
rpccall += "<value><struct><member><name>property</name><value>"+(*j)+"</value></member></struct></value>";
|
||||||
|
rpccall += "</data></array></value>";
|
||||||
|
rpccall += "</member>";
|
||||||
|
}
|
||||||
|
|
||||||
|
rpccall += "</struct>";
|
||||||
|
|
||||||
|
return rpccall;
|
||||||
|
}
|
||||||
|
|
||||||
|
parsedParameters::parsedParameters():
|
||||||
|
m_error(NOERROR),
|
||||||
|
m_user(""),
|
||||||
|
m_ticket(""),
|
||||||
|
m_defaultDisplay(""),
|
||||||
|
m_addConfigFile(""),
|
||||||
|
m_test(false),
|
||||||
|
m_ignoreerrors(false) {}
|
||||||
|
|
||||||
|
string parsedParameters::toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile) {
|
||||||
|
// begin method call
|
||||||
|
string rpccall = "<?xml version=\"1.0\"?><methodCall><methodName>hsadmin.transaction</methodName><params>";
|
||||||
|
|
||||||
|
// ticket
|
||||||
|
rpccall += "<param><value><string>";
|
||||||
|
if( this->m_ticket != "" ) {
|
||||||
|
string ticket;
|
||||||
|
ifstream file(this->m_ticket.c_str());
|
||||||
|
if( ! file ) {
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::CouldNotOpenFile);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % this->m_ticket;
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
char ch;
|
||||||
|
while(file.get(ch)) ticket += ch;
|
||||||
|
|
||||||
|
boost::regex findticket(".*\\n---\\n");
|
||||||
|
|
||||||
|
ticket = boost::regex_replace(ticket,findticket,"");
|
||||||
|
if( ticket[ticket.size()-1] == '\0' ) ticket = ticket.substr(0,ticket.size()-2);
|
||||||
|
|
||||||
|
rpccall += ticket;
|
||||||
|
} else {
|
||||||
|
rpccall += cfgfile->getTicket(username);
|
||||||
|
}
|
||||||
|
Logger::log(Logger::DEBUG,"have read ticket");
|
||||||
|
rpccall += "</string></value></param>";
|
||||||
|
|
||||||
|
// global Parameters
|
||||||
|
rpccall += "<param><value><struct>";
|
||||||
|
if( this->m_test )
|
||||||
|
rpccall += "<member><name>test</name><value><boolean>1</boolean></value></member>";
|
||||||
|
rpccall += "</struct></value></param>";
|
||||||
|
|
||||||
|
// calls Array
|
||||||
|
rpccall += "<param><value><array><data>";
|
||||||
|
for( vector<shared_ptr<callParameter> >::iterator c = m_call.begin(); c != m_call.end(); c++ )
|
||||||
|
rpccall += "<value>"+((*c)->toXML(username,cfgfile))+"</value>";
|
||||||
|
|
||||||
|
rpccall += "</data></array></value></param>";
|
||||||
|
|
||||||
|
rpccall += "</params></methodCall>\n";
|
||||||
|
|
||||||
|
return rpccall;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// specific Parser for --runas-Option
|
||||||
|
|
||||||
|
bool VerbosityOption::parseThis(vector<string>& options, shared_ptr<parsedParameters> result) {
|
||||||
|
bool rval = false;
|
||||||
|
if( starts_with(options[0], "-v") ) {
|
||||||
|
if( options[1] == "none" ||
|
||||||
|
options[1] == "normal" ||
|
||||||
|
options[1] == "high" ||
|
||||||
|
options[1] == "debug" ||
|
||||||
|
options[1] == "debugXML" ||
|
||||||
|
options[1] == "debugAll" ) {
|
||||||
|
if( rval = this->handle(options[1], result) ) {
|
||||||
|
if( options[0] == "-v" )
|
||||||
|
options.erase(options.begin(),options.begin()+2);
|
||||||
|
else {
|
||||||
|
erase_first(options[0], "v");
|
||||||
|
options.erase(options.begin()+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
string p;
|
||||||
|
if( rval = this->handle(p, result) ) {
|
||||||
|
if( options[0] == "-v" )
|
||||||
|
options.erase(options.begin());
|
||||||
|
else
|
||||||
|
erase_first(options[0], "v");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( starts_with(options[0], "--verbosity=") ) {
|
||||||
|
string p = options[0].substr(12);
|
||||||
|
if( rval = this->handle(p, result) )
|
||||||
|
options.erase(options.begin());
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
// constuctors
|
||||||
|
|
||||||
|
TestOption::TestOption() {
|
||||||
|
m_longName = "test";
|
||||||
|
m_shortName = "t";
|
||||||
|
}
|
||||||
|
|
||||||
|
IgnoreErrorOption::IgnoreErrorOption() {
|
||||||
|
m_longName = "ignoreerror";
|
||||||
|
m_shortName = "e";
|
||||||
|
}
|
||||||
|
|
||||||
|
IgnoreErrorsOption::IgnoreErrorsOption() {
|
||||||
|
m_longName = "ignoreerrors";
|
||||||
|
m_shortName = "E";
|
||||||
|
}
|
||||||
|
|
||||||
|
VerbosityOption::VerbosityOption() {
|
||||||
|
m_longName = "verbosity";
|
||||||
|
m_shortName = "v";
|
||||||
|
m_parameterSeparator = "=";
|
||||||
|
}
|
||||||
|
|
||||||
|
RunAsOption::RunAsOption() {
|
||||||
|
m_longName = "runas";
|
||||||
|
m_shortName = "r";
|
||||||
|
m_parameterSeparator = "=";
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketOption::TicketOption() {
|
||||||
|
m_longName = "ticket";
|
||||||
|
m_shortName = "T";
|
||||||
|
m_parameterSeparator = "=";
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigOption::ConfigOption() {
|
||||||
|
m_longName = "config";
|
||||||
|
m_shortName = "C";
|
||||||
|
m_parameterSeparator = "=";
|
||||||
|
}
|
||||||
|
|
||||||
|
ForceOption::ForceOption() {
|
||||||
|
m_longName = "force";
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalsOption::GlobalsOption() {
|
||||||
|
m_longName = "globals";
|
||||||
|
m_shortName = "l";
|
||||||
|
}
|
||||||
|
|
||||||
|
WhereOption::WhereOption() {
|
||||||
|
m_longName = "where";
|
||||||
|
m_shortName = "w";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
OnlyOption::OnlyOption() {
|
||||||
|
m_longName = "only";
|
||||||
|
m_shortName = "W";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
SetOption::SetOption() {
|
||||||
|
m_longName = "set";
|
||||||
|
m_shortName = "s";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAllOption::SetAllOption() {
|
||||||
|
m_longName = "setall";
|
||||||
|
m_shortName = "S";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
InfileOption::InfileOption() {
|
||||||
|
m_longName = "infile";
|
||||||
|
m_shortName = "f";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderOption::OrderOption() {
|
||||||
|
m_longName = "order";
|
||||||
|
m_shortName = "o";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalOrderOption::GlobalOrderOption() {
|
||||||
|
m_longName = "global-order";
|
||||||
|
m_shortName = "O";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
InputOption::InputOption() {
|
||||||
|
m_longName = "input";
|
||||||
|
m_shortName = "i";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
PassInputOption::PassInputOption() {
|
||||||
|
m_longName = "passinput";
|
||||||
|
m_shortName = "p";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayOption::DisplayOption() {
|
||||||
|
m_longName = "display";
|
||||||
|
m_shortName = "d";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultDisplayOption::DefaultDisplayOption() {
|
||||||
|
m_longName = "default-display";
|
||||||
|
m_shortName = "D";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
CallOption::CallOption() {
|
||||||
|
m_longName = "call";
|
||||||
|
m_shortName = "c";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
UnsetOption::UnsetOption() {
|
||||||
|
m_longName = "unset";
|
||||||
|
m_shortName = "u";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
UnsetAllOption::UnsetAllOption() {
|
||||||
|
m_longName = "unsetall";
|
||||||
|
m_shortName = "U";
|
||||||
|
m_parameterSeparator = ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectID::ObjectID() { };
|
||||||
|
|
||||||
|
|
||||||
|
// handle functions
|
||||||
|
|
||||||
|
bool TestOption::handle(shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_test = true;
|
||||||
|
Logger::log(Logger::DEBUG," found test Option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IgnoreErrorOption::handle(shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
result->m_call.back()->m_ignoreerror = true;
|
||||||
|
Logger::log(Logger::DEBUG," found ignoreerror Option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IgnoreErrorsOption::handle(shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_ignoreerrors = true;
|
||||||
|
Logger::log(Logger::DEBUG," found ignoreerrors Option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VerbosityOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( parameter == "none" ) Logger::setLevel(0);
|
||||||
|
else if( parameter == "normal") Logger::setLevel(1);
|
||||||
|
else if( parameter == "high") Logger::setLevel(2);
|
||||||
|
else if( parameter == "debug") Logger::setLevel(3);
|
||||||
|
else if( parameter == "debugXML") Logger::setLevel(4);
|
||||||
|
else if( parameter == "debugAll") Logger::setLevel(5);
|
||||||
|
else Logger::incrementLevel();
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," set Verbosity Level to "+lexical_cast<string>(Logger::level));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QuietOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
Logger::decrementLevel();
|
||||||
|
Logger::log(Logger::DEBUG," set Verbosity Level to "+lexical_cast<string>(Logger::level));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RunAsOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_user = parameter;
|
||||||
|
Logger::log(Logger::DEBUG," found runas Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TicketOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_ticket = parameter;
|
||||||
|
Logger::log(Logger::DEBUG," found ticket Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_addConfigFile = parameter;
|
||||||
|
Logger::log(Logger::DEBUG," found config Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ForceOption::handle(shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
result->m_call.back()->m_force = true;
|
||||||
|
Logger::log(Logger::DEBUG," found force Option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GlobalsOption::handle(shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
result->m_call.back()->m_globalOrderIndex = result->m_call.back()->m_order.size();
|
||||||
|
Logger::log(Logger::DEBUG," found globals Option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WhereOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string property(parameter,0,pos);
|
||||||
|
string pattern(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
|
||||||
|
whereParameter *where = new whereParameter();
|
||||||
|
where->m_property = property;
|
||||||
|
where->m_pattern = pattern;
|
||||||
|
|
||||||
|
result->m_call.back()->m_where.push_back(shared_ptr<whereParameter>(where));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found where Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnlyOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string property(parameter,0,pos);
|
||||||
|
string pattern(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
|
||||||
|
whereParameter *where = new whereParameter();
|
||||||
|
where->m_property = property;
|
||||||
|
where->m_pattern = pattern;
|
||||||
|
|
||||||
|
result->m_only.push_back(shared_ptr<whereParameter>(where));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found only Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UnsetOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result->m_call.back()->m_unset.push_back(parameter);
|
||||||
|
Logger::log(Logger::DEBUG," found unset Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UnsetAllOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_unsetall.push_back(parameter);
|
||||||
|
Logger::log(Logger::DEBUG," found unsetall Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OrderOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string *property;
|
||||||
|
string * direction;
|
||||||
|
if( pos != string::npos ) {
|
||||||
|
property = new string(parameter,0,pos);
|
||||||
|
direction = new string(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
} else {
|
||||||
|
property = new string(parameter);
|
||||||
|
direction = new string("a");
|
||||||
|
}
|
||||||
|
|
||||||
|
orderParameter *order = new orderParameter();
|
||||||
|
order->m_property = *property;
|
||||||
|
order->m_ascending = ((*direction)[0] == 'a');
|
||||||
|
|
||||||
|
result->m_call.back()->m_order.push_back(shared_ptr<orderParameter>(order));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found order Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GlobalOrderOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string *property;
|
||||||
|
string * direction;
|
||||||
|
if( pos != string::npos ) {
|
||||||
|
property = new string(parameter,0,pos);
|
||||||
|
direction = new string(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
} else {
|
||||||
|
property = new string(parameter);
|
||||||
|
direction = new string("a");
|
||||||
|
}
|
||||||
|
|
||||||
|
orderParameter *order = new orderParameter();
|
||||||
|
order->m_property = *property;
|
||||||
|
order->m_ascending = ((*direction)[0] == 'a');
|
||||||
|
|
||||||
|
result->m_globalOrder.push_back(shared_ptr<orderParameter>(order));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found global order Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SetOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string property(parameter,0,pos);
|
||||||
|
string value(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
|
||||||
|
setParameter *set = new setParameter();
|
||||||
|
set->m_property = property;
|
||||||
|
set->m_value = value;
|
||||||
|
|
||||||
|
result->m_call.back()->m_set.push_back(shared_ptr<setParameter>(set));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found set Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SetAllOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string property(parameter,0,pos);
|
||||||
|
string value(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
|
||||||
|
setParameter *set = new setParameter();
|
||||||
|
set->m_property = property;
|
||||||
|
set->m_value = value;
|
||||||
|
|
||||||
|
result->m_setall.push_back(shared_ptr<setParameter>(set));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found setall Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InfileOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string::size_type pos = parameter.find('=');
|
||||||
|
string property(parameter,0,pos);
|
||||||
|
string filename(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
|
||||||
|
setParameter *set = new setParameter();
|
||||||
|
set->m_property = property;
|
||||||
|
|
||||||
|
ifstream file(filename.c_str());
|
||||||
|
if( ! file ) {
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::CouldNotOpenFile);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % filename;
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
char ch;
|
||||||
|
while(file.get(ch)) set->m_value += ch;
|
||||||
|
|
||||||
|
result->m_call.back()->m_set.push_back(shared_ptr<setParameter>(set));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found infile Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InputOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setParameter *set = new setParameter();
|
||||||
|
set->m_property = parameter;
|
||||||
|
cout << "Eingabe (" << parameter << "): " << flush;
|
||||||
|
std::getline(cin, set->m_value);
|
||||||
|
|
||||||
|
result->m_call.back()->m_set.push_back(shared_ptr<setParameter>(set));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found input Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
string readPasswd() {
|
||||||
|
string rval = "";
|
||||||
|
struct termios t, t2;
|
||||||
|
|
||||||
|
tcgetattr(0,&t);
|
||||||
|
t2 = t;
|
||||||
|
t2.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(0,TCSANOW,&t2);
|
||||||
|
std::getline(cin, rval);
|
||||||
|
tcsetattr(0,TCSANOW,&t);
|
||||||
|
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PassInputOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setParameter *set = new setParameter();
|
||||||
|
set->m_property = parameter;
|
||||||
|
cout << "Passworteingabe (" << parameter << "): " << flush;
|
||||||
|
set->m_value = readPasswd();
|
||||||
|
|
||||||
|
result->m_call.back()->m_set.push_back(shared_ptr<setParameter>(set));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found password-input Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DisplayOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result->m_call.back()->m_display = parameter;
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found display Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefaultDisplayOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
result->m_defaultDisplay = parameter;
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found default display Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ObjectID::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
if( result->m_call.size() <= 0 ) {
|
||||||
|
result->m_error = NeedCall;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result->m_call.back()->m_objects.push_back(parameter);
|
||||||
|
Logger::log(Logger::DEBUG," found an ObjectID: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CallOption::handle(string ¶meter, shared_ptr<parsedParameters> result) {
|
||||||
|
string::size_type pos = parameter.find('.');
|
||||||
|
string module(parameter,0,pos);
|
||||||
|
string function(parameter,(pos != string::npos)?(pos+1):(string::npos));
|
||||||
|
|
||||||
|
callParameter *call = new callParameter();
|
||||||
|
call->m_module = module;
|
||||||
|
call->m_function = function;
|
||||||
|
|
||||||
|
result->m_call.push_back(shared_ptr<callParameter>(call));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG," found call Option: "+parameter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
386
hsacppcli/hsadminc/source/cmdlineparser.h
Normal file
386
hsacppcli/hsadminc/source/cmdlineparser.h
Normal file
@ -0,0 +1,386 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
|
#include "abstractcmdlineparser.h"
|
||||||
|
#include "configfile.h"
|
||||||
|
|
||||||
|
//! here comes the commandline-Parser - with help of the abstractcommandlineparser.
|
||||||
|
|
||||||
|
namespace commandline {
|
||||||
|
|
||||||
|
#ifndef HSADMIN_CMDLINEPARSER
|
||||||
|
#define HSADMIN_CMDLINEPARSER
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::string;
|
||||||
|
using std::map;
|
||||||
|
using boost::shared_ptr;
|
||||||
|
using boost::scoped_ptr;
|
||||||
|
|
||||||
|
// Parameter Objects are the resultof each Parser step and used in second step.
|
||||||
|
|
||||||
|
//! parsed values of a --setall, --set, --input, --passinput or a --infile option
|
||||||
|
class setParameter {
|
||||||
|
public:
|
||||||
|
string m_property;
|
||||||
|
string m_value;
|
||||||
|
|
||||||
|
string toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parsed values of a --only or a --where option
|
||||||
|
class whereParameter {
|
||||||
|
public:
|
||||||
|
string m_property;
|
||||||
|
string m_pattern;
|
||||||
|
|
||||||
|
string toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parsed values of a --global-order or a --order option
|
||||||
|
class orderParameter {
|
||||||
|
public:
|
||||||
|
string m_property;
|
||||||
|
bool m_ascending;
|
||||||
|
|
||||||
|
string toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! a whole parsed --call Option which holds all the relevant other options
|
||||||
|
class callParameter {
|
||||||
|
public:
|
||||||
|
callParameter(): m_module(""), m_function(""), m_display(""), m_ignoreerror(false), m_force(false), m_globalOrderIndex(-1) { };
|
||||||
|
|
||||||
|
string m_module;
|
||||||
|
string m_function;
|
||||||
|
|
||||||
|
string m_display;
|
||||||
|
vector<shared_ptr<setParameter> > m_set;
|
||||||
|
vector<shared_ptr<whereParameter> > m_where;
|
||||||
|
vector<shared_ptr<orderParameter> > m_order;
|
||||||
|
vector<string> m_objects;
|
||||||
|
vector<string> m_unset;
|
||||||
|
|
||||||
|
bool m_ignoreerror;
|
||||||
|
bool m_force;
|
||||||
|
int m_globalOrderIndex;
|
||||||
|
|
||||||
|
vector<string> parseDisplayspec();
|
||||||
|
string evalDisplay(const map<string, string> &values);
|
||||||
|
string toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
enum parseError { NOERROR = 0, NeedCall = 1 };
|
||||||
|
|
||||||
|
//! all the parsed values
|
||||||
|
class parsedParameters {
|
||||||
|
public:
|
||||||
|
parsedParameters();
|
||||||
|
parseError m_error;
|
||||||
|
string m_user;
|
||||||
|
string m_ticket;
|
||||||
|
string m_defaultDisplay;
|
||||||
|
string m_addConfigFile;
|
||||||
|
bool m_test;
|
||||||
|
bool m_ignoreerrors;
|
||||||
|
vector<shared_ptr<whereParameter> > m_only;
|
||||||
|
vector<shared_ptr<setParameter> > m_setall;
|
||||||
|
vector<shared_ptr<orderParameter> > m_globalOrder;
|
||||||
|
vector<shared_ptr<callParameter> > m_call;
|
||||||
|
vector<string> m_unsetall;
|
||||||
|
|
||||||
|
string toXML(string &username, shared_ptr< ::ConfigFileParser > cfgfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Option classes are used in first Parse step
|
||||||
|
|
||||||
|
//! --test
|
||||||
|
class TestOption: public abstractcommandlineparser::CmdLineOption<true,true,false,parsedParameters> {
|
||||||
|
public:
|
||||||
|
TestOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --ignoreerror
|
||||||
|
class IgnoreErrorOption: public abstractcommandlineparser::CmdLineOption<true,true,false,parsedParameters> {
|
||||||
|
public:
|
||||||
|
IgnoreErrorOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --ignoreerrors
|
||||||
|
class IgnoreErrorsOption: public IgnoreErrorOption {
|
||||||
|
public:
|
||||||
|
IgnoreErrorsOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --verbosity
|
||||||
|
class VerbosityOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
VerbosityOption();
|
||||||
|
bool parseThis(vector<string>& options, shared_ptr<parsedParameters> result);
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --quiet
|
||||||
|
class QuietOption: public abstractcommandlineparser::CmdLineOption<true,true,false,parsedParameters> {
|
||||||
|
public:
|
||||||
|
QuietOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --runas
|
||||||
|
class RunAsOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
RunAsOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --ticket
|
||||||
|
class TicketOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
TicketOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --config
|
||||||
|
class ConfigOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
ConfigOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string & parameter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --force
|
||||||
|
class ForceOption: public abstractcommandlineparser::CmdLineOption<true,false,false,parsedParameters> {
|
||||||
|
public:
|
||||||
|
ForceOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --globals
|
||||||
|
class GlobalsOption: public abstractcommandlineparser::CmdLineOption<true,true,false,parsedParameters> {
|
||||||
|
public:
|
||||||
|
GlobalsOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --where
|
||||||
|
class WhereOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
WhereOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --only
|
||||||
|
class OnlyOption: public WhereOption {
|
||||||
|
public:
|
||||||
|
OnlyOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --set
|
||||||
|
class SetOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
SetOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --setall
|
||||||
|
class SetAllOption: public SetOption {
|
||||||
|
public:
|
||||||
|
SetAllOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --infile
|
||||||
|
class InfileOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
InfileOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --order
|
||||||
|
class OrderOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
OrderOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --global-order
|
||||||
|
class GlobalOrderOption: public OrderOption {
|
||||||
|
public:
|
||||||
|
GlobalOrderOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --input
|
||||||
|
class InputOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
InputOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --passinput
|
||||||
|
class PassInputOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
PassInputOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --display
|
||||||
|
class DisplayOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
DisplayOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --default-display
|
||||||
|
class DefaultDisplayOption: public DisplayOption {
|
||||||
|
public:
|
||||||
|
DefaultDisplayOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --call
|
||||||
|
class CallOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
CallOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --unset
|
||||||
|
class UnsetOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
UnsetOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! --unsetall
|
||||||
|
class UnsetAllOption: public abstractcommandlineparser::CmdLineOption<true,true,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
UnsetAllOption();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! all other parameters are objectIDs.
|
||||||
|
class ObjectID: public abstractcommandlineparser::CmdLineOption<false,false,true,parsedParameters> {
|
||||||
|
public:
|
||||||
|
ObjectID();
|
||||||
|
protected:
|
||||||
|
virtual bool handle(string ¶meter, shared_ptr<parsedParameters> result);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! putting it all together in a typelist
|
||||||
|
typedef Parameterlist24(
|
||||||
|
TestOption,
|
||||||
|
IgnoreErrorsOption,
|
||||||
|
VerbosityOption,
|
||||||
|
RunAsOption,
|
||||||
|
TicketOption,
|
||||||
|
ConfigOption,
|
||||||
|
SetAllOption,
|
||||||
|
UnsetAllOption,
|
||||||
|
OnlyOption,
|
||||||
|
GlobalOrderOption,
|
||||||
|
DefaultDisplayOption,
|
||||||
|
IgnoreErrorOption,
|
||||||
|
ForceOption,
|
||||||
|
GlobalsOption,
|
||||||
|
WhereOption,
|
||||||
|
SetOption,
|
||||||
|
InfileOption,
|
||||||
|
OrderOption,
|
||||||
|
InputOption,
|
||||||
|
PassInputOption,
|
||||||
|
UnsetOption,
|
||||||
|
DisplayOption,
|
||||||
|
ObjectID,
|
||||||
|
CallOption ) allParameters;
|
||||||
|
|
||||||
|
//! generating a class with parse()-function from the list of Options
|
||||||
|
typedef abstractcommandlineparser::CmdLineOptionList<allParameters, parsedParameters> Parameters;
|
||||||
|
|
||||||
|
#else
|
||||||
|
class parsedParameters;
|
||||||
|
class setParameter;
|
||||||
|
class whereParameter;
|
||||||
|
class orderParameter;
|
||||||
|
class callParameter;
|
||||||
|
class TestOption;
|
||||||
|
class IgnoreErrorOption;
|
||||||
|
class IgnoreErrorsOption;
|
||||||
|
class VerbosityOption;
|
||||||
|
class RunAsOption;
|
||||||
|
class TicketOption;
|
||||||
|
class ConfigOption;
|
||||||
|
class SetAllOption;
|
||||||
|
class OnlyOption;
|
||||||
|
class UnsetAllOption;
|
||||||
|
class GlobalOrderOption;
|
||||||
|
class DefaultDisplayOption;
|
||||||
|
class ForceOption;
|
||||||
|
class GlobalsOption;
|
||||||
|
class WhereOption;
|
||||||
|
class SetOption;
|
||||||
|
class InfileOption;
|
||||||
|
class OrderOption;
|
||||||
|
class InputOption;
|
||||||
|
class PassInputOption;
|
||||||
|
class DisplayOption;
|
||||||
|
class unsetOption;
|
||||||
|
class CallOption;
|
||||||
|
class ObjectID;
|
||||||
|
|
||||||
|
#endif /* HSADMIN_CMDLINEPARSER */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
257
hsacppcli/hsadminc/source/configfile.cpp
Normal file
257
hsacppcli/hsadminc/source/configfile.cpp
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "configfile.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
#include <boost/filesystem/exception.hpp>
|
||||||
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
using std::ostringstream;
|
||||||
|
using std::istringstream;
|
||||||
|
using std::ifstream;
|
||||||
|
using std::fstream;
|
||||||
|
using std::string;
|
||||||
|
using boost::lexical_cast;
|
||||||
|
using boost::bad_lexical_cast;
|
||||||
|
|
||||||
|
ConfigFileFinder::ConfigFileFinder(Transaction& t): vector<string*>() {
|
||||||
|
try {
|
||||||
|
boost::filesystem::path general("/etc/hsadminc.conf");
|
||||||
|
if( boost::filesystem::exists(general) && !boost::filesystem::is_directory(general) )
|
||||||
|
this->loadFile(general.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
|
||||||
|
string priv = getenv("HOME");
|
||||||
|
try {
|
||||||
|
boost::filesystem::path p( priv + "/.hsadmin.conf");
|
||||||
|
|
||||||
|
if( boost::filesystem::exists(p) && !boost::filesystem::is_directory(p) )
|
||||||
|
this->loadFile(p.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
|
||||||
|
shared_ptr<commandline::parsedParameters> params = t.getParsed();
|
||||||
|
if( params->m_addConfigFile != "" ) try {
|
||||||
|
boost::filesystem::path c( params->m_addConfigFile);
|
||||||
|
|
||||||
|
if( boost::filesystem::exists(c) && !boost::filesystem::is_directory(c) )
|
||||||
|
this->loadFile(c.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigFileFinder::loadFile(string filename) {
|
||||||
|
ifstream file(filename.c_str(),std::ios::in);
|
||||||
|
ostringstream reader;
|
||||||
|
reader << file.rdbuf();
|
||||||
|
string *tmp = new string(reader.str());
|
||||||
|
this->insert(this->end(),tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigFileParser::parse(string& text) {
|
||||||
|
vector<string> lines;
|
||||||
|
config * current = &(this->basic);
|
||||||
|
vector<config> configs;
|
||||||
|
|
||||||
|
boost::split(lines,text,boost::is_any_of("\n"));
|
||||||
|
|
||||||
|
if( current->pattern != ".*" ) {
|
||||||
|
current->pattern = ".*";
|
||||||
|
current->ticketcommand = "hsadmint \\0";
|
||||||
|
current->server = "http://localhost:7777/RPC2";
|
||||||
|
current->shell = "/bin/sh";
|
||||||
|
current->askpass = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( vector<string>::iterator i = lines.begin(); i != lines.end(); i++ ) {
|
||||||
|
string& line = *i;
|
||||||
|
// ignore coments and empty lines
|
||||||
|
boost::trim_left(line);
|
||||||
|
if( line[0] == '#' || line == "" )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// is this a section?
|
||||||
|
if( line[0] == '[' ) {
|
||||||
|
line.erase(0,1);
|
||||||
|
line.erase(line.rfind(']'));
|
||||||
|
|
||||||
|
if( current != &(this->basic) ) {
|
||||||
|
configs.insert(configs.end(),*current);
|
||||||
|
delete(current);
|
||||||
|
}
|
||||||
|
current = new config;
|
||||||
|
*current = this->basic;
|
||||||
|
|
||||||
|
current->pattern = line;
|
||||||
|
} else {
|
||||||
|
string::size_type equals = line.find('=');
|
||||||
|
string name = boost::trim_copy(line.substr(0,equals));
|
||||||
|
string value = boost::trim_copy(line.substr(equals+1));
|
||||||
|
|
||||||
|
// trim name and value
|
||||||
|
boost::trim(name);
|
||||||
|
boost::trim(value);
|
||||||
|
|
||||||
|
if( name == "ticket" )
|
||||||
|
current->ticketcommand = value;
|
||||||
|
else if( name == "server" )
|
||||||
|
current->server = value;
|
||||||
|
else if( name == "shell" )
|
||||||
|
current->shell = value;
|
||||||
|
else if( name == "askpass" && value == "true" )
|
||||||
|
current->askpass = true;
|
||||||
|
else if( name == "askpass" && value == "false" )
|
||||||
|
current->askpass = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( current != &(this->basic) ) {
|
||||||
|
configs.insert(configs.end(),*current);
|
||||||
|
delete(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->configs.insert(this->configs.begin(),configs.begin(),configs.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
string ConfigFileParser::replaceStringMatches(string &userpattern, string username, string content) {
|
||||||
|
if( username == "" ) {
|
||||||
|
char* u = (char*)malloc(L_cuserid+1);;
|
||||||
|
cuserid(u);
|
||||||
|
if( u != 0 ) username = u;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boost::regex pattern(userpattern);
|
||||||
|
boost::cmatch results;
|
||||||
|
if( !boost::regex_match(username.c_str(),results,pattern) ) return content;
|
||||||
|
|
||||||
|
for(int j = 0; j < results.size(); j++) {
|
||||||
|
ostringstream p;
|
||||||
|
p << "^\\\\" << j << "|([^\\\\])\\\\" << j;
|
||||||
|
boost::regex pat(p.str());
|
||||||
|
|
||||||
|
string replace = "$1";
|
||||||
|
if( results[j].matched ) for( const char* i = results[j].first; i != results[j].second; i++ )
|
||||||
|
replace += *i;
|
||||||
|
|
||||||
|
content = boost::regex_replace(content,pat,replace);
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ConfigFileParser::getTicket(string &username) {
|
||||||
|
string ticketstring = "";
|
||||||
|
config cfg = this->getConfig(username);
|
||||||
|
string command = cfg.getTicketcommand(username);
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"use '"+command+"' as command");
|
||||||
|
|
||||||
|
pid_t pid;
|
||||||
|
pid_t parentpid = getpid();
|
||||||
|
int cmdout[2];
|
||||||
|
|
||||||
|
if(pipe(cmdout) || (pid=fork()) == -1)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
if(!pid) {
|
||||||
|
close(1);
|
||||||
|
close(cmdout[0]);
|
||||||
|
dup(cmdout[1]);
|
||||||
|
//command = cfg.shell+" -c \""+command+"\"";
|
||||||
|
|
||||||
|
// this should never return.
|
||||||
|
execlp(cfg.shell.c_str(),cfg.shell.c_str(),"-c",command.c_str(),(char*)0);
|
||||||
|
|
||||||
|
// if we have reached this something has gone wrong.
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::ErrorWithTicketCommand);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % cfg.shell % command % Logger::getErrnoMessage(errno);
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int status;
|
||||||
|
waitpid(pid,&status,0);
|
||||||
|
close(cmdout[1]);
|
||||||
|
|
||||||
|
// check if ticket has been successfully generated
|
||||||
|
if( !WIFEXITED(status) || WEXITSTATUS(status) )
|
||||||
|
exit(WEXITSTATUS(status));
|
||||||
|
|
||||||
|
char buf[257];
|
||||||
|
bzero(buf,257);
|
||||||
|
errno = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while( (i = read(cmdout[0],buf,256)) != 0 ) {
|
||||||
|
if( i < 0 ) {
|
||||||
|
if( errno == EAGAIN ) {
|
||||||
|
usleep(20);
|
||||||
|
continue;
|
||||||
|
} else if( errno == EINTR ) continue;
|
||||||
|
else {
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::ErrorReadingTicket);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % Logger::getErrnoMessage(errno);
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
}
|
||||||
|
ticketstring += buf;
|
||||||
|
if( strlen(buf) < i ) break;
|
||||||
|
bzero(buf,257);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ticketstring;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigFileParser::config &ConfigFileParser::getConfig(string &username) {
|
||||||
|
if( username == "" ) return basic;
|
||||||
|
|
||||||
|
for( vector<config>::iterator i = configs.begin(); i != configs.end(); i++ ) {
|
||||||
|
boost::regex pat(i->pattern);
|
||||||
|
if(boost::regex_match(username,pat)) return *i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return basic;
|
||||||
|
}
|
||||||
|
|
94
hsacppcli/hsadminc/source/configfile.h
Normal file
94
hsacppcli/hsadminc/source/configfile.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifndef HSADMIN_CONFIGFILE
|
||||||
|
#define HSADMIN_CONFIGFILE
|
||||||
|
|
||||||
|
#include "transaction.h"
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::string;
|
||||||
|
using std::iostream;
|
||||||
|
|
||||||
|
//! this class manages configfiles
|
||||||
|
class ConfigFileFinder: public vector<string*> {
|
||||||
|
public:
|
||||||
|
//! find the standard config-files
|
||||||
|
ConfigFileFinder(Transaction& t);
|
||||||
|
//! load a config file
|
||||||
|
void loadFile(string filename);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parser for config files
|
||||||
|
class ConfigFileParser {
|
||||||
|
public:
|
||||||
|
//! parses one text
|
||||||
|
inline ConfigFileParser(string& text) { this->parse(text); };
|
||||||
|
//! parses multiple texts
|
||||||
|
inline ConfigFileParser(vector<string*>* texts) { this->parse(texts); };
|
||||||
|
|
||||||
|
inline string getTicket() { string s = ""; return getTicket(s); };
|
||||||
|
|
||||||
|
/** \brief get a ticket for a specified user.
|
||||||
|
*
|
||||||
|
* this function finds the config for this user and calls the tocket-command
|
||||||
|
* with the specified shell.
|
||||||
|
*/
|
||||||
|
string getTicket(string &username);
|
||||||
|
|
||||||
|
//! replaces references (\0, \1, etc.) in content with regex-matches.
|
||||||
|
static string replaceStringMatches(string &userpattern, string username, string content);
|
||||||
|
|
||||||
|
//! holds single config entries
|
||||||
|
struct config {
|
||||||
|
string pattern;
|
||||||
|
string ticketcommand;
|
||||||
|
string server;
|
||||||
|
string shell;
|
||||||
|
bool askpass;
|
||||||
|
|
||||||
|
string getTicketcommand(string &username) { return ConfigFileParser::replaceStringMatches(pattern,username,ticketcommand); };
|
||||||
|
string getServer(string &username) { return ConfigFileParser::replaceStringMatches(pattern,username,ticketcommand); };
|
||||||
|
string getShell(string &username) { return ConfigFileParser::replaceStringMatches(pattern,username,ticketcommand); };
|
||||||
|
};
|
||||||
|
|
||||||
|
//! find the config for a specified user
|
||||||
|
config& getConfig(string &username);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void parse(string& text);
|
||||||
|
inline void parse(vector<string*>* texts) {
|
||||||
|
for( vector<string*>::iterator i = texts->begin(); i != texts->end(); i++ )
|
||||||
|
this->parse(**i);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<config> configs;
|
||||||
|
config basic;
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class ConfigFileFinder;
|
||||||
|
class ConfigFileParser;
|
||||||
|
|
||||||
|
#endif /* HSADMIN_CONFIGFILE */
|
155
hsacppcli/hsadminc/source/hsadminc.cpp
Normal file
155
hsacppcli/hsadminc/source/hsadminc.cpp
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
#include "cmdlineparser.h"
|
||||||
|
#include "configfile.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include "transaction.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::vector;
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
using boost::shared_ptr;
|
||||||
|
using boost::scoped_ptr;
|
||||||
|
using boost::starts_with;
|
||||||
|
|
||||||
|
void printErrorMessage(Transaction& transact, vector<string>& options) {
|
||||||
|
shared_ptr<commandline::parsedParameters> p = transact.getParsed();
|
||||||
|
string FailedOption = options[0];
|
||||||
|
if( starts_with(FailedOption,"--") )
|
||||||
|
FailedOption = FailedOption.substr(2);
|
||||||
|
else if( starts_with(FailedOption,"-") )
|
||||||
|
FailedOption = FailedOption.substr(1,2);
|
||||||
|
|
||||||
|
cerr << "Error on Commandline at Parameter '"<< FailedOption;
|
||||||
|
if( p->m_error == commandline::NeedCall )
|
||||||
|
cerr << ": call specific Parameter before call";
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printUsage(char* cmdname) {
|
||||||
|
cerr << "Usage: " << endl << endl;
|
||||||
|
cerr << cmdname << " [--test|-t]" << endl;
|
||||||
|
cerr << "[--ignoreerrors|-e]" << endl;
|
||||||
|
cerr << "[--verbosity=<level>|-v <level>]" << endl;
|
||||||
|
cerr << "[--quiet|-q]" << endl;
|
||||||
|
cerr << "[--runas=<user>|-r <user>]" << endl;
|
||||||
|
cerr << "[--ticket=<ticketfile>|-T <ticketfile>]" << endl;
|
||||||
|
cerr << "[--config=<configfile>|-C <configfile>]" << endl;
|
||||||
|
cerr << "[--default-display:<displaySpec>|-D <displaySpec>]" << endl;
|
||||||
|
cerr << "[(--only:<property_1>=<expr_1>|-W <property_1>=<expr_1>)" << endl;
|
||||||
|
cerr << " ... (--only:<property_n>=<expr_n>|-W <property_n>=<expr_n>)]" << endl;
|
||||||
|
cerr << "[(--setall:<property_1>=<value_1>|-S <property_1>=<value_1>)" << endl;
|
||||||
|
cerr << " ... (--setall:<property_n>=<value_n>|-S <property_n>=<value_n>)]" << endl;
|
||||||
|
cerr << " [(--unsetall:property_1|-U property_1) ... (--unsetall:property_n|-U property_n)]" << endl;
|
||||||
|
cerr << "[(--global-order:<property_1>[=(asc|desc|a|d)]|-O <property_1>[=(asc|desc|a|d)])" << endl;
|
||||||
|
cerr << " ..." << endl;
|
||||||
|
cerr << " (--global-order:<property_n>[=(asc|desc|a|d)]|-O <property_n>[=(asc|desc|a|d)]]" << endl;
|
||||||
|
cerr << " [--ignoreerrors|-E]" << endl;
|
||||||
|
cerr << "(--call:<module_1>.<function_1>|-c <module_1>.<function_1>)" << endl;
|
||||||
|
cerr << " [--force]" << endl;
|
||||||
|
cerr << " [--ignoreerror|-e]" << endl;
|
||||||
|
cerr << " [--display:<displaySpec>|-d <displaySpec>]" << endl;
|
||||||
|
cerr << " [(--where:<property_1_1>=<expr_1_1>|-w <property_1_1>=<expr_1_1>)" << endl;
|
||||||
|
cerr << " ... (--where:<property_1_n>=<expr_1_n>|-w <property_1_n>=<expr_1_n>)]" << endl;
|
||||||
|
cerr << " [(--set:<property_1_1>=<value_1_1>|-s <property_1_1>=<value_1_1>)" << endl;
|
||||||
|
cerr << " ... (--set:<property_1_n>=<value_1_n>|-s <property_1_n>=<value_1_n>)]" << endl;
|
||||||
|
cerr << " [(--input:<property_1_1>|-i <property_1_1>)" << endl;
|
||||||
|
cerr << " ... (--input:<property_1_n>|-i <property_1_n>)]" << endl;
|
||||||
|
cerr << " [(--passinput:<property_1_1>|-p <property_1_1>)" << endl;
|
||||||
|
cerr << " ... (--passinput:<property_1_n>|-p <property_1_n>)]" << endl;
|
||||||
|
cerr << " [(--infile:<property_1_1>=<file_1_1>|-f <property_1_1>=<file_1_1>)" << endl;
|
||||||
|
cerr << " ... (--infile:<property_1_n>=<file_1_n>|-f <property_1_n>=<file_1_n>)]" << endl;
|
||||||
|
cerr << " [(--unset:property_1_1|-u property_1_1]) ... (--unset:property_1_n|-u property_1_n])]" << endl;
|
||||||
|
cerr << " [(--order:<property_1_1>[=(asc|desc|a|d)]|-o <property_1_1>[=(asc|desc|a|d)])" << endl;
|
||||||
|
cerr << " ..." << endl;
|
||||||
|
cerr << " [--globals|-l]" << endl;
|
||||||
|
cerr << " ..." << endl;
|
||||||
|
cerr << " (--order:<property_1_n>[=(asc|desc|a|d)]|-o <property_1_n>[=(asc|desc|a|d)]]" << endl;
|
||||||
|
cerr << " [object_1_1 ... object_1_n]" << endl;
|
||||||
|
cerr << "..." << endl;
|
||||||
|
cerr << "(--call:<module_m>.<function_m>|-c <module_m>.<function_m>)" << endl;
|
||||||
|
cerr << " [--force]" << endl;
|
||||||
|
cerr << " [--ignoreerror|-e]" << endl;
|
||||||
|
cerr << " [--display:<displaySpec>|-d <displaySpec>]" << endl;
|
||||||
|
cerr << " [(--where:<property_m_1>=<expr_m_1>|-w <property_m_1>=<expr_m_1>)" << endl;
|
||||||
|
cerr << " ... (--where:<property_m_n>=<expr_m_n>|-w <property_m_n>=<expr_m_n>)]" << endl;
|
||||||
|
cerr << " [(--set:<property_m_1>=<value_m_1>|-s <property_m_1>=<value_m_1>)" << endl;
|
||||||
|
cerr << " ... (--set:<property_m_n>=<value_m_n>|-s <property_m_n>=<value_m_n>)]" << endl;
|
||||||
|
cerr << " [(--input:<property_m_1>|-i <property_m_1>)" << endl;
|
||||||
|
cerr << " ... (--input:<property_m_n>|-i <property_m_n>)]" << endl;
|
||||||
|
cerr << " [(--passinput:<property_m_1>|-p <property_m_1>)" << endl;
|
||||||
|
cerr << " ... (--passinput:<property_m_n>|-p <property_m_n>)]" << endl;
|
||||||
|
cerr << " [(--infile:<property_m_1>=<file_m_1>|-f <property_m_1>=<file_m_1>)" << endl;
|
||||||
|
cerr << " ... (--infile:<property_m_n>=<file_m_n>|-f <property_m_n>=<file_m_n>)]" << endl;
|
||||||
|
cerr << " [(--unset:property_m_1|-u property_m_1]) ... (--unset:property_m_n|-u property_m_n])]" << endl;
|
||||||
|
cerr << " [(--order:<property_m_1>[=(asc|desc|a|d)]|-o <property_m_1>[=(asc|desc|a|d)])" << endl;
|
||||||
|
cerr << " ..." << endl;
|
||||||
|
cerr << " [--globals|-l]" << endl;
|
||||||
|
cerr << " ..." << endl;
|
||||||
|
cerr << " (--order:<property_m_n>[=(asc|desc|a|d)]|-o <property_m_n>[=(asc|desc|a|d)]]" << endl;
|
||||||
|
cerr << " [object_m_1 ... object_m_n]" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if( argc == 1 ) {
|
||||||
|
printUsage(*argv);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
vector<string> options(argv+1,argv+argc);
|
||||||
|
Transaction transact(options);
|
||||||
|
|
||||||
|
if( !transact ) {
|
||||||
|
printErrorMessage(transact, options);
|
||||||
|
printUsage(*argv);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"have parsed Parameters");
|
||||||
|
|
||||||
|
scoped_ptr<ConfigFileFinder> cfff(new ConfigFileFinder(transact));
|
||||||
|
shared_ptr<ConfigFileParser> cfg(new ConfigFileParser(cfff.get()));
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"have read config File");
|
||||||
|
|
||||||
|
transact(cfg);
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"have executed Transaction");
|
||||||
|
|
||||||
|
//cout << transact.formatOutput();
|
||||||
|
//exit(transact.errorCode());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
146
hsacppcli/hsadminc/source/httpclient.cpp
Normal file
146
hsacppcli/hsadminc/source/httpclient.cpp
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "httpclient.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::streamsize;
|
||||||
|
using std::iostream;
|
||||||
|
using boost::lexical_cast;
|
||||||
|
using boost::bad_lexical_cast;
|
||||||
|
|
||||||
|
TCPDevice::TCPDevice(const string& address, const short int port) {
|
||||||
|
this->init(address.c_str(),port);
|
||||||
|
}
|
||||||
|
TCPDevice::TCPDevice(const char* address, const short int port) {
|
||||||
|
this->init(address,port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPDevice::init(const char* address, const short int port) {
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
bzero(&addr,sizeof(addr));
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
if( (addr.sin_addr.s_addr = inet_addr(address)) == INADDR_NONE ) {
|
||||||
|
struct hostent* hp = gethostbyname(address);
|
||||||
|
if( hp == 0 ) throw("can't resolve hostname '"+string(address)+"'");
|
||||||
|
bcopy(hp->h_addr, (char*) &addr.sin_addr, hp->h_length);
|
||||||
|
}
|
||||||
|
addr.sin_port = htons(port);
|
||||||
|
|
||||||
|
if( (m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0 ) throw(string("can't open socket"));
|
||||||
|
if( ::connect(m_socket, (struct sockaddr*) &addr, sizeof(addr)) < 0 ) {
|
||||||
|
::close(m_socket);
|
||||||
|
throw("can't connect to '"+string(address)+"' port "+(lexical_cast<string>(port)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TCPDevice::TCPDevice(const int socket) : m_socket(socket) {}
|
||||||
|
TCPDevice::TCPDevice(const TCPDevice& other) : m_socket(other.m_socket) { }
|
||||||
|
|
||||||
|
TCPDevice::~TCPDevice() { }
|
||||||
|
|
||||||
|
void TCPDevice::closeSocket() { ::close(m_socket); }
|
||||||
|
|
||||||
|
streamsize TCPDevice::read(char* s, streamsize n) { return (streamsize)::read(m_socket,(void*)s,(size_t)n); }
|
||||||
|
|
||||||
|
streamsize TCPDevice::write(const char* s, streamsize n) { return (streamsize)::write(m_socket,(const void*)s,(size_t)n); }
|
||||||
|
|
||||||
|
GenericHttpClient::GenericHttpClient(const string &url, const unsigned short defaultPort = 80):
|
||||||
|
m_url(url), m_defaultPort(defaultPort) {};
|
||||||
|
|
||||||
|
string GenericHttpClient::post(string postcontent) {
|
||||||
|
iostream *connection;
|
||||||
|
try { connection = this->parseUrl(); }
|
||||||
|
catch(string &e) {
|
||||||
|
Logger::log(Logger::FATAL,"connection failed: "+e);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
if( connection == 0 ) return "";
|
||||||
|
|
||||||
|
string outbuf = "POST "+m_path+" HTTP/1.1\r\n";
|
||||||
|
outbuf += "Connection: close\r\n";
|
||||||
|
outbuf += "User-Agent: hsadmin CLI client\r\n";
|
||||||
|
outbuf += "Content-Type: text/xml\r\n";
|
||||||
|
outbuf += "Content-Length: "+boost::lexical_cast<string>(postcontent.length())+"\r\n";
|
||||||
|
outbuf += "Host: "+m_hostname+"\r\n\r\n";
|
||||||
|
outbuf += postcontent;
|
||||||
|
|
||||||
|
for( int i = 0; i < outbuf.length(); i++ )
|
||||||
|
(*connection) << outbuf[i];;
|
||||||
|
|
||||||
|
connection->flush();
|
||||||
|
|
||||||
|
string reply = "";
|
||||||
|
|
||||||
|
char buf[257];
|
||||||
|
do { // we simply ignore the http header in the response
|
||||||
|
bzero(buf,257);
|
||||||
|
connection->getline(buf,256);
|
||||||
|
} while( string(buf) != "" && string(buf) != "\r" );
|
||||||
|
|
||||||
|
string tmp;
|
||||||
|
do {
|
||||||
|
tmp = "";
|
||||||
|
(*connection) >> tmp;
|
||||||
|
reply += " "+tmp;
|
||||||
|
} while( tmp.length() );
|
||||||
|
|
||||||
|
this->close();
|
||||||
|
delete connection;
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
};
|
||||||
|
|
||||||
|
iostream * GenericHttpClient::parseUrl() {
|
||||||
|
int protocolend = m_url.find("://");
|
||||||
|
m_protocol = m_url.substr(0,protocolend);
|
||||||
|
if( ! this->checkProtocol(m_protocol) ) return (iostream *)0;
|
||||||
|
|
||||||
|
int hostnameend = m_url.find("/",protocolend+3);
|
||||||
|
m_hostname = m_url.substr(protocolend+3,hostnameend-(protocolend+3));
|
||||||
|
m_port = m_defaultPort;
|
||||||
|
m_path = m_url.substr(hostnameend);
|
||||||
|
int portstart = m_hostname.find(":");
|
||||||
|
if( portstart >= 0 ) {
|
||||||
|
string portstring = m_hostname.substr(portstart+1);
|
||||||
|
|
||||||
|
if( portstring.size() > 0 ) {
|
||||||
|
try {
|
||||||
|
m_port = lexical_cast<int>(portstring.c_str());
|
||||||
|
m_hostname = m_hostname.substr(0,m_hostname.find(":"));
|
||||||
|
} catch(bad_lexical_cast &) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->getConnection(m_hostname, m_port);
|
||||||
|
};
|
||||||
|
|
||||||
|
GenericHttpClient *createHttpClient(const string &url) {
|
||||||
|
int protocolend = url.find("://");
|
||||||
|
string protocol = url.substr(0,protocolend);
|
||||||
|
if( protocol == "http" ) return (GenericHttpClient *) new HttpClient<HTTP>(url);
|
||||||
|
if( protocol == "https" ) return (GenericHttpClient *) new HttpClient<HTTPS>(url);
|
||||||
|
return 0;
|
||||||
|
}
|
163
hsacppcli/hsadminc/source/httpclient.h
Normal file
163
hsacppcli/hsadminc/source/httpclient.h
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/iostreams/stream.hpp>
|
||||||
|
|
||||||
|
#include "sslclient.h"
|
||||||
|
|
||||||
|
#ifndef HSADMIN_HTTPCLIENT
|
||||||
|
#define HSADMIN_HTTPCLIENT
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::iostream;
|
||||||
|
using std::streamsize;
|
||||||
|
using boost::lexical_cast;
|
||||||
|
using boost::bad_lexical_cast;
|
||||||
|
|
||||||
|
//! A Socket as a Device
|
||||||
|
class TCPDevice : public boost::iostreams::device<boost::iostreams::bidirectional> {
|
||||||
|
public:
|
||||||
|
//! create a TCP-Stream by connecting to the given port at the given address
|
||||||
|
TCPDevice(const string& address, const short int port);
|
||||||
|
//! create a TCP-Stream by connecting to the given port at the given address
|
||||||
|
TCPDevice(const char* address, const short int port);
|
||||||
|
//! create a TCP-Stream from a connected socket - use this with accept
|
||||||
|
TCPDevice(const int socket);
|
||||||
|
//! copy constructor
|
||||||
|
TCPDevice(const TCPDevice& other);
|
||||||
|
//! does not close the socket - use closeSocket before deleting the Device.
|
||||||
|
virtual ~TCPDevice();
|
||||||
|
//! closes the socket
|
||||||
|
void closeSocket();
|
||||||
|
|
||||||
|
//! read n Bytes from socket
|
||||||
|
virtual streamsize read(char* s, streamsize n);
|
||||||
|
//! write n Bytes to socket
|
||||||
|
virtual streamsize write(const char* s, streamsize n);
|
||||||
|
private:
|
||||||
|
void init(const char* address, const short int port);
|
||||||
|
int m_socket;
|
||||||
|
};
|
||||||
|
|
||||||
|
//class SSLDevice;
|
||||||
|
|
||||||
|
const int HTTP = 0;
|
||||||
|
const int HTTPS = 1;
|
||||||
|
|
||||||
|
//! the basic HTTP Client - can only handle POST method.
|
||||||
|
class GenericHttpClient {
|
||||||
|
public:
|
||||||
|
//! initialize HTTP CLient with URL and default Port (usually 80)
|
||||||
|
GenericHttpClient(const string &url, const unsigned short defaultPort);
|
||||||
|
//! Post
|
||||||
|
string post(string postcontent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! get a buffered iostream for the connection - must be overridden by derived classes
|
||||||
|
virtual iostream * getConnection(const string &host, unsigned short port) = 0;
|
||||||
|
//! check if this class can handle the protocol - must be overridden by derived classes
|
||||||
|
virtual bool checkProtocol(const string &protocol) { return false; };
|
||||||
|
//! close the underlying connection
|
||||||
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
iostream * parseUrl();
|
||||||
|
const string& m_url;
|
||||||
|
string m_protocol;
|
||||||
|
string m_hostname;
|
||||||
|
string m_path;
|
||||||
|
unsigned short m_port;
|
||||||
|
const unsigned short m_defaultPort;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! This template should usually be used in one of the specialized Versions below.
|
||||||
|
template <int protocol> class HttpClient: public GenericHttpClient {
|
||||||
|
public:
|
||||||
|
HttpClient(const string &url, unsigned short defaultPort = 80): GenericHttpClient(url,defaultPort) {};
|
||||||
|
protected:
|
||||||
|
iostream * getConnection(const string &host, unsigned short port) { return (iostream *)0; };
|
||||||
|
bool checkProtocol(const string &p) { return false; };
|
||||||
|
virtual void close() { };
|
||||||
|
};
|
||||||
|
|
||||||
|
//! a HTTP CLient with a plain TCP socket as transport
|
||||||
|
template <> class HttpClient<HTTP>: public GenericHttpClient {
|
||||||
|
public:
|
||||||
|
//! initialize HTTP CLient with URL and default Port (usually 80)
|
||||||
|
HttpClient(const string &url, unsigned short defaultPort = 80): GenericHttpClient(url,defaultPort), device(0) {};
|
||||||
|
protected:
|
||||||
|
//! get a buffered iostream for the connection
|
||||||
|
iostream * getConnection(const string &host, unsigned short port) {
|
||||||
|
if( device == 0 ) device = new TCPDevice(host,port);
|
||||||
|
return (iostream *) new boost::iostreams::stream<TCPDevice>(*device);
|
||||||
|
}
|
||||||
|
//! check if this class can handle the protocol
|
||||||
|
bool checkProtocol(const string &protocol) { return (protocol == "http"); };
|
||||||
|
//! close the underlying connection
|
||||||
|
virtual void close() { device->closeSocket(); };
|
||||||
|
private:
|
||||||
|
TCPDevice *device;
|
||||||
|
};
|
||||||
|
//! a HTTP CLient with a SSL stream as transport
|
||||||
|
template <> class HttpClient<HTTPS>: public GenericHttpClient {
|
||||||
|
public:
|
||||||
|
//! initialize HTTPS CLient with URL and default Port (usually 443)
|
||||||
|
HttpClient(const string &url, unsigned short defaultPort = 443): GenericHttpClient(url,defaultPort), device(0) {};
|
||||||
|
protected:
|
||||||
|
//! get a buffered iostream for the connection
|
||||||
|
iostream * getConnection(const string &host, unsigned short port) {
|
||||||
|
try {
|
||||||
|
if( device == 0 ) device = new SSLDevice(host,port);
|
||||||
|
return (iostream *) new boost::iostreams::stream<SSLDevice>(*device);
|
||||||
|
} catch( SSLDevice::CertificateError &e ) {
|
||||||
|
if( device != 0 ) {
|
||||||
|
delete(device);
|
||||||
|
device = 0;
|
||||||
|
}
|
||||||
|
std::cerr << e.msg << std::endl;
|
||||||
|
return (iostream *)0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//! check if this class can handle the protocol
|
||||||
|
bool checkProtocol(const string &protocol) { return (protocol == "https"); };
|
||||||
|
//! close the underlying connection
|
||||||
|
virtual void close() { device->closeSocket(); };
|
||||||
|
private:
|
||||||
|
SSLDevice *device;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief get the best HTTP client for the defined Protocol
|
||||||
|
*
|
||||||
|
* returns HttpClient<HTTP> or HttpClient<HTTPS> depending on the protocol
|
||||||
|
*/
|
||||||
|
GenericHttpClient *createHttpClient(const string &uri);
|
||||||
|
|
||||||
|
#else /* HSADMIN_HTTPCLIENT */
|
||||||
|
class TCPDevice;
|
||||||
|
class GenericHttpClient;
|
||||||
|
genericHttpClient *createHttpClient(url);
|
||||||
|
|
||||||
|
extern const int HTTP = 0;
|
||||||
|
extern const int HTTPS = 1;
|
||||||
|
#endif /* HSADMIN_HTTPCLIENT */
|
136
hsacppcli/hsadminc/source/logger.cpp
Normal file
136
hsacppcli/hsadminc/source/logger.cpp
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <boost/filesystem/exception.hpp>
|
||||||
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
namespace Logger {
|
||||||
|
|
||||||
|
const int FATAL = 1;
|
||||||
|
const int ERROR = 2;
|
||||||
|
const int WARNING = 4;
|
||||||
|
const int DEBUG = 8;
|
||||||
|
const int XML = 16;
|
||||||
|
int levels[6] = { 1, 3, 7, 15, 23, 31 };
|
||||||
|
int level = 1;
|
||||||
|
|
||||||
|
std::map<int,std::string> messages;
|
||||||
|
|
||||||
|
void setLevel(int newlevel) {
|
||||||
|
level = newlevel;
|
||||||
|
if( level > 5 ) level = 5;
|
||||||
|
if( level < 0 ) level = 0;
|
||||||
|
}
|
||||||
|
void incrementLevel() {
|
||||||
|
level++;
|
||||||
|
if( level > 5 ) level = 5;
|
||||||
|
}
|
||||||
|
void decrementLevel() {
|
||||||
|
level--;
|
||||||
|
if( level < 0 ) level = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void log(int type, const std::string text) {
|
||||||
|
int bitmask = levels[level];
|
||||||
|
|
||||||
|
if( type & bitmask )
|
||||||
|
std::cerr << text << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void insertMessages(std::string filename) {
|
||||||
|
std::ifstream file(filename.c_str(),std::ios::in);
|
||||||
|
if( !file ) return;
|
||||||
|
|
||||||
|
char input[1024];
|
||||||
|
|
||||||
|
while(!file.eof()) {
|
||||||
|
bzero(input,1024);
|
||||||
|
file.getline(input,1023);
|
||||||
|
char *c = input;
|
||||||
|
// ignore whitespace at beginning of line
|
||||||
|
while( *c == ' ' || *c == '\t' ) c++;
|
||||||
|
// lines that dont't begin with a digit are ignored
|
||||||
|
if( *c < '0' || *c > '9' ) continue;
|
||||||
|
char *i = c;
|
||||||
|
while( *c >= '0' && *c <= '9' ) c++;
|
||||||
|
char *j = c;
|
||||||
|
while( *c == ' ' || *c == '\t' ) c++;
|
||||||
|
// the digit istn't followed by a '=' -> ignore this line
|
||||||
|
if( *c != '=' ) continue;
|
||||||
|
// separate number from content
|
||||||
|
*j = '\0';
|
||||||
|
std::string number(i);
|
||||||
|
std::string formatstring(c+1);
|
||||||
|
messages[boost::lexical_cast<int>(number)] = boost::trim_copy(formatstring);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadMessages() {
|
||||||
|
std::string lang = getenv("LANG");
|
||||||
|
std::string priv = getenv("HOME");
|
||||||
|
|
||||||
|
try {
|
||||||
|
boost::filesystem::path general("/etc/hsadminc.messages");
|
||||||
|
if( boost::filesystem::exists(general) && !boost::filesystem::is_directory(general) )
|
||||||
|
insertMessages(general.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
boost::filesystem::path generalLang("/etc/hsadminc.messages."+lang);
|
||||||
|
if( boost::filesystem::exists(generalLang) && !boost::filesystem::is_directory(generalLang) )
|
||||||
|
insertMessages(generalLang.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
boost::filesystem::path p( priv + "/.hsadmin.messages" );
|
||||||
|
if( boost::filesystem::exists(p) && !boost::filesystem::is_directory(p) )
|
||||||
|
insertMessages(p.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
boost::filesystem::path pLang( priv + "/.hsadmin.messages."+lang );
|
||||||
|
if( boost::filesystem::exists(pLang) && !boost::filesystem::is_directory(pLang) )
|
||||||
|
insertMessages(pLang.native());
|
||||||
|
} catch(boost::filesystem::filesystem_error) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getErrnoMessage(int e) {
|
||||||
|
if( messages.empty() ) loadMessages();
|
||||||
|
std::map<int,std::string>::iterator i = messages.find(e);
|
||||||
|
if( i != messages.end() ) return i->second;
|
||||||
|
else return std::string("");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getMessageFormatString(const message msg) {
|
||||||
|
return getErrnoMessage((int)msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
68
hsacppcli/hsadminc/source/logger.h
Normal file
68
hsacppcli/hsadminc/source/logger.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef HSADMIN_LOGGER
|
||||||
|
#define HSADMIN_LOGGER
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
//! a simple logger
|
||||||
|
namespace Logger {
|
||||||
|
extern const int FATAL;
|
||||||
|
extern const int ERROR;
|
||||||
|
extern const int WARNING;
|
||||||
|
extern const int DEBUG;
|
||||||
|
extern const int XML;
|
||||||
|
|
||||||
|
extern int levels[6];
|
||||||
|
extern int level;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CouldNotOpenFile = 1001,
|
||||||
|
NoBodyInResponse = 1002,
|
||||||
|
CantResolveHostname = 1003,
|
||||||
|
CantOpenSocket = 1004,
|
||||||
|
CantConnetcToHost = 1005,
|
||||||
|
ServerErrorCode = 1006,
|
||||||
|
UnknownCallbackInXMLParser = 1007,
|
||||||
|
ConnectionFailed = 1008,
|
||||||
|
ErrorWithTicketCommand = 1009,
|
||||||
|
ErrorReadingTicket = 1010
|
||||||
|
} message;
|
||||||
|
|
||||||
|
//! change the loglevel - used by VerbosityOption
|
||||||
|
void setLevel(int newlevel);
|
||||||
|
//! increment the loglevel - used by VerbosityOption
|
||||||
|
void incrementLevel();
|
||||||
|
//! decrement theloglevel - used by QuietOption
|
||||||
|
void decrementLevel();
|
||||||
|
|
||||||
|
//! do actualy output loginfo
|
||||||
|
void log(int type, const std::string text);
|
||||||
|
|
||||||
|
//! get a message format string for a defined Message Type; use boost::format to insert Values
|
||||||
|
std::string getMessageFormatString(const message msg);
|
||||||
|
//! get an appropriate Message for an errno.
|
||||||
|
std::string getErrnoMessage(int e);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* HSADMIN_LOGGER */
|
171
hsacppcli/hsadminc/source/sslclient.cpp
Normal file
171
hsacppcli/hsadminc/source/sslclient.cpp
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "sslclient.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <gnutls/x509.h>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::streamsize;
|
||||||
|
using boost::lexical_cast;
|
||||||
|
using boost::bad_lexical_cast;
|
||||||
|
|
||||||
|
int SSLDevice::countInstances = 0;
|
||||||
|
|
||||||
|
SSLDevice::SSLDevice(const string& address, const short int port): m_session(0) {
|
||||||
|
this->init(address.c_str(),port);
|
||||||
|
}
|
||||||
|
SSLDevice::SSLDevice(const char* address, const short int port): m_session(0) {
|
||||||
|
this->init(address,port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSLDevice::init(const char* address, const short int port) {
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
bzero(&addr,sizeof(addr));
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
if( (addr.sin_addr.s_addr = inet_addr(address)) == INADDR_NONE ) {
|
||||||
|
struct hostent* hp = gethostbyname(address);
|
||||||
|
if( hp == 0 ) throw("can't resolve hostname '"+string(address)+"'");
|
||||||
|
bcopy(hp->h_addr, (char*) &addr.sin_addr, hp->h_length);
|
||||||
|
}
|
||||||
|
addr.sin_port = htons(port);
|
||||||
|
|
||||||
|
if( (m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0 ) throw(string("can't open socket"));
|
||||||
|
if( ::connect(m_socket, (struct sockaddr*) &addr, sizeof(addr)) < 0 ) {
|
||||||
|
::close(m_socket);
|
||||||
|
throw("can't connect to '"+string(address)+"' port "+(lexical_cast<string>(port)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int cert_type_priority[3] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
|
||||||
|
|
||||||
|
m_session = new gnutls_session;
|
||||||
|
|
||||||
|
if( countInstances == 0 ) gnutls_global_init();
|
||||||
|
countInstances++;
|
||||||
|
|
||||||
|
gnutls_certificate_allocate_credentials(&m_xcred);
|
||||||
|
gnutls_certificate_set_x509_trust_file(m_xcred, "ca.pem", GNUTLS_X509_FMT_PEM);
|
||||||
|
|
||||||
|
gnutls_init(m_session,GNUTLS_CLIENT);
|
||||||
|
|
||||||
|
gnutls_set_default_priority(*m_session);
|
||||||
|
|
||||||
|
gnutls_credentials_set(*m_session, GNUTLS_CRD_CERTIFICATE, m_xcred);
|
||||||
|
|
||||||
|
gnutls_transport_set_ptr(*m_session, (gnutls_transport_ptr)&m_socket);
|
||||||
|
|
||||||
|
if( gnutls_handshake(*m_session) < 0 )
|
||||||
|
throw(string(gnutls_protocol_get_name(gnutls_protocol_get_version(*m_session)))+" Handshake failed");
|
||||||
|
|
||||||
|
verify_certificate( *m_session, address);
|
||||||
|
}
|
||||||
|
SSLDevice::SSLDevice(const SSLDevice& other) : m_session(other.m_session), m_socket(other.m_socket), m_xcred(other.m_xcred) { }
|
||||||
|
SSLDevice::~SSLDevice() { }
|
||||||
|
|
||||||
|
void SSLDevice::closeSocket() {
|
||||||
|
gnutls_bye(*m_session, GNUTLS_SHUT_RDWR);
|
||||||
|
gnutls_certificate_free_credentials(m_xcred);
|
||||||
|
::close(m_socket);
|
||||||
|
gnutls_deinit(*m_session);
|
||||||
|
delete(m_session);
|
||||||
|
|
||||||
|
countInstances--;
|
||||||
|
if( countInstances == 0 ) gnutls_global_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
streamsize SSLDevice::read(char* s, streamsize n) { return (streamsize)gnutls_record_recv(*m_session,(void*)s,(size_t)n); }
|
||||||
|
streamsize SSLDevice::write(const char* s, streamsize n) {
|
||||||
|
/*streamsize i = (streamsize)gnutls_record_send(*m_session,(const void*)s,(size_t)n);
|
||||||
|
Logger::log(Logger::DEBUG,string("sending ")+boost::lexical_cast<string>(i)+" von "+boost::lexical_cast<string>(n)+" bytes: \n---\n"+s+"\n---\n");*/
|
||||||
|
return (streamsize)gnutls_record_send(*m_session,(const void*)s,(size_t)n); //i;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSLDevice::verify_certificate( gnutls_session session, string hostname) {
|
||||||
|
boost::filesystem::path general("/etc/hsadminc.cert");
|
||||||
|
if( boost::filesystem::exists(general) && !boost::filesystem::is_directory(general) )
|
||||||
|
gnutls_certificate_set_x509_trust_file (m_xcred, general.native().c_str(), GNUTLS_X509_FMT_PEM);
|
||||||
|
//string privfilename = getenv("HOME");
|
||||||
|
string priv = getenv("HOME");
|
||||||
|
boost::filesystem::path p( priv + "/.hsadmin.cert" );
|
||||||
|
//p /= ".hsadminc.conf";
|
||||||
|
|
||||||
|
if( boost::filesystem::exists(p) && !boost::filesystem::is_directory(p) )
|
||||||
|
gnutls_certificate_set_x509_trust_file (m_xcred, p.native().c_str(), GNUTLS_X509_FMT_PEM);
|
||||||
|
//gnutls_certificate_set_x509_trust_file (m_xcred, const char * cafile, PEM)
|
||||||
|
|
||||||
|
unsigned int status = 0;//gnutls_certificate_verify_peers(*m_session);
|
||||||
|
/*if( gnutls_certificate_verify_peers2(*m_session, &status) < 0 )
|
||||||
|
throw(string("Error while verifying certificate"));*/
|
||||||
|
|
||||||
|
string tval = "Certificate Verification failed: ";
|
||||||
|
if( status & GNUTLS_CERT_INVALID ) { throw(tval+"The certificate is not trustet"); }
|
||||||
|
if( status & GNUTLS_CERT_SIGNER_NOT_FOUND ) { throw(tval+"The certificate has no known Issuer"); }
|
||||||
|
if( status & GNUTLS_CERT_REVOKED ) { throw(tval+"The certificate has been revoked"); }
|
||||||
|
|
||||||
|
// the further checks are only valid for X509 certificates
|
||||||
|
if ( gnutls_certificate_type_get(session) != GNUTLS_CRT_X509) return;
|
||||||
|
|
||||||
|
const gnutls_datum* cert_list;
|
||||||
|
unsigned int cert_list_size;
|
||||||
|
gnutls_x509_crt cert;
|
||||||
|
|
||||||
|
if ( gnutls_x509_crt_init(&cert) < 0) throw(tval+"error in initialization");
|
||||||
|
|
||||||
|
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
|
||||||
|
if ( cert_list == NULL ) throw(tval+"no certificate found");
|
||||||
|
|
||||||
|
bool failed = false;
|
||||||
|
string tReason = "";
|
||||||
|
for( int i = 0; i < cert_list_size-1; i++ ) {
|
||||||
|
bool failed = false;
|
||||||
|
|
||||||
|
if ( gnutls_x509_crt_import( cert, &cert_list[0], GNUTLS_X509_FMT_DER) < 0)
|
||||||
|
throw(tval+"error parsing certificate Number "+lexical_cast<string>(i));
|
||||||
|
|
||||||
|
if ( gnutls_x509_crt_get_expiration_time(cert) < time(0) ) {
|
||||||
|
tReason = "The certificate has expired";
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( gnutls_x509_crt_get_activation_time(cert) > time(0) ) {
|
||||||
|
tReason = "The certificate is not yet activated";
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
if ( !gnutls_x509_crt_check_hostname(cert,hostname.c_str()) ) {
|
||||||
|
tReason = "The certificate’s owner does not match hostname ’";
|
||||||
|
tReason += hostname +"'";
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
gnutls_x509_crt_deinit(cert);
|
||||||
|
|
||||||
|
if( !failed ) break;
|
||||||
|
}
|
||||||
|
if( failed ) throw(tval+tReason);
|
||||||
|
}
|
73
hsacppcli/hsadminc/source/sslclient.h
Normal file
73
hsacppcli/hsadminc/source/sslclient.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/iostreams/stream.hpp>
|
||||||
|
|
||||||
|
#include <gnutls/gnutls.h>
|
||||||
|
|
||||||
|
#ifndef HSADMIN_SSLCLIENT
|
||||||
|
#define HSADMIN_SSLCLIENT
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::streamsize;
|
||||||
|
|
||||||
|
//! A SSL connection as a Device
|
||||||
|
class SSLDevice : public boost::iostreams::device<boost::iostreams::bidirectional> {
|
||||||
|
public:
|
||||||
|
//! create a SSL-Stream by connecting to the given port at the given address and checking the Certificate
|
||||||
|
SSLDevice(const string& address, const short int port);
|
||||||
|
//! create a SSL-Stream by connecting to the given port at the given address and checking the Certificate
|
||||||
|
SSLDevice(const char* address, const short int port);
|
||||||
|
//! copy constructor
|
||||||
|
SSLDevice(const SSLDevice& other);
|
||||||
|
//! does not close the SSL strem - use closeSocket before deleting the Device.
|
||||||
|
virtual ~SSLDevice();
|
||||||
|
//! closes the SSL Stream
|
||||||
|
void closeSocket();
|
||||||
|
|
||||||
|
//! read n Bytes from SSL Stream
|
||||||
|
virtual streamsize read(char* s, streamsize n);
|
||||||
|
//! write n Bytes to SSL stream
|
||||||
|
virtual streamsize write(const char* s, streamsize n);
|
||||||
|
|
||||||
|
//! indicates an error while checking the certificate
|
||||||
|
class CertificateError {
|
||||||
|
public:
|
||||||
|
CertificateError(const string &s): msg(s) {};
|
||||||
|
CertificateError(const char* s): msg(s) {};
|
||||||
|
string msg;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
void init(const char* address, const short int port);
|
||||||
|
void verify_certificate( gnutls_session session, string hostname);
|
||||||
|
|
||||||
|
gnutls_session *m_session;
|
||||||
|
gnutls_certificate_credentials m_xcred;
|
||||||
|
int m_socket;
|
||||||
|
|
||||||
|
static int countInstances;
|
||||||
|
};
|
||||||
|
|
||||||
|
#else /* HSADMIN_SSLCLIENT */
|
||||||
|
class SSLDevice;
|
||||||
|
#endif /* HSADMIN_SSLCLIENT */
|
502
hsacppcli/hsadminc/source/transaction.cpp
Normal file
502
hsacppcli/hsadminc/source/transaction.cpp
Normal file
@ -0,0 +1,502 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "transaction.h"
|
||||||
|
#include "xmlparser.h"
|
||||||
|
#include "httpclient.h"
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
using boost::lexical_cast;
|
||||||
|
using boost::bad_lexical_cast;
|
||||||
|
using namespace xmlParser;
|
||||||
|
|
||||||
|
Transaction::Transaction(vector<string> options) :
|
||||||
|
abstractcommandlineparser::CmdLineParser<commandline::Parameters,commandline::parsedParameters>(options),
|
||||||
|
m_nextAttributeValue(""),
|
||||||
|
m_globalFault(false),
|
||||||
|
m_currentCall(0) {
|
||||||
|
if(!this->m_parseSuccessful) return;
|
||||||
|
|
||||||
|
vector<shared_ptr<commandline::callParameter> >& calls = m_parsed->m_call;
|
||||||
|
|
||||||
|
for( vector<shared_ptr<commandline::callParameter> >::iterator c = calls.begin(); c != calls.end(); c++ ) {
|
||||||
|
shared_ptr<commandline::callParameter> call = *c;
|
||||||
|
|
||||||
|
vector<shared_ptr<commandline::orderParameter> >::iterator orderhere = call->m_order.end();
|
||||||
|
if( call->m_globalOrderIndex >= 0 ) orderhere = call->m_order.begin()+call->m_globalOrderIndex;
|
||||||
|
|
||||||
|
call->m_order.insert( orderhere, m_parsed->m_globalOrder.begin(), m_parsed->m_globalOrder.end() );
|
||||||
|
call->m_where.insert( call->m_where.end(), m_parsed->m_only.begin(), m_parsed->m_only.end() );
|
||||||
|
call->m_set.insert( call->m_set.end(), m_parsed->m_setall.begin(), m_parsed->m_setall.end() );
|
||||||
|
call->m_unset.insert( call->m_unset.end(), m_parsed->m_unsetall.begin(), m_parsed->m_unsetall.end() );
|
||||||
|
|
||||||
|
if( m_parsed->m_ignoreerrors ) call->m_ignoreerror = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void Transaction::operator()(shared_ptr<ConfigFileParser> cfgfile) {
|
||||||
|
|
||||||
|
class {
|
||||||
|
public:
|
||||||
|
void post(string &url) {
|
||||||
|
GenericHttpClient * client = createHttpClient(url);
|
||||||
|
m_response = client->post(m_request);
|
||||||
|
};
|
||||||
|
|
||||||
|
void execCall(Transaction *t, string &username, string &url, shared_ptr<ConfigFileParser> cfgfile) {
|
||||||
|
m_request = t->getParsed()->toXML(username,cfgfile);
|
||||||
|
Logger::log(Logger::XML,"--XML request--\n"+m_request+"\n---");
|
||||||
|
|
||||||
|
this->post(url);
|
||||||
|
|
||||||
|
ResponseParser parse;
|
||||||
|
if( !parse(m_response, t) ) Logger::log(Logger::XML,"parse error");
|
||||||
|
Logger::log(Logger::XML,"response parsed:");
|
||||||
|
|
||||||
|
if(Logger::XML && Logger::levels[Logger::level]) logNode(t->m_docelem,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void logNode(Node* node, int ind) {
|
||||||
|
Text *text;
|
||||||
|
Element *elm;
|
||||||
|
string indent = "";
|
||||||
|
for( int j = 0; j < ind; j++ ) indent += " ";
|
||||||
|
string attributes;
|
||||||
|
|
||||||
|
switch(node->m_type) {
|
||||||
|
case ELEMENT:
|
||||||
|
elm = (Element*)node;
|
||||||
|
for(map<string,string>::iterator i = elm->m_attributes.begin(); i != elm->m_attributes.end(); i++)
|
||||||
|
attributes += " "+(i->first)+"=\""+(i->second)+"\"";
|
||||||
|
Logger::log(Logger::XML,indent+"<"+elm->m_name+attributes+">");
|
||||||
|
for( vector<Node*>::iterator i = elm->m_nodes.begin(); i != elm->m_nodes.end(); i++ )
|
||||||
|
logNode(*i,ind+1);
|
||||||
|
Logger::log(Logger::XML,indent+"</"+elm->m_name+">");
|
||||||
|
break;
|
||||||
|
case TEXT:
|
||||||
|
text = (Text*)node;
|
||||||
|
Logger::log(Logger::XML,indent+text->m_content);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int connectToHost(const string hostname, const int port) const {
|
||||||
|
int sock;
|
||||||
|
|
||||||
|
struct sockaddr_in server_addr;
|
||||||
|
server_addr.sin_family = AF_INET;
|
||||||
|
if( (server_addr.sin_addr.s_addr = inet_addr(hostname.c_str())) == INADDR_NONE ) {
|
||||||
|
struct hostent* hp = gethostbyname(hostname.c_str());
|
||||||
|
if( hp == 0 ) {
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::CantResolveHostname);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % hostname;
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
bcopy(hp->h_addr, (char*) &server_addr.sin_addr, hp->h_length);
|
||||||
|
}
|
||||||
|
server_addr.sin_port = htons(port);
|
||||||
|
|
||||||
|
if( (sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0 ) {
|
||||||
|
Logger::log(Logger::FATAL,Logger::getMessageFormatString(Logger::CantOpenSocket));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if( connect(sock, (struct sockaddr*) &server_addr, sizeof(server_addr)) < 0 ) {
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::CantConnetcToHost);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % hostname % port;
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
close(sock);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
string m_request;
|
||||||
|
string m_response;
|
||||||
|
} XMLRPCrequest;
|
||||||
|
|
||||||
|
|
||||||
|
string username = "";
|
||||||
|
ConfigFileParser::config cfg = cfgfile->getConfig(username);
|
||||||
|
string url = cfg.server;
|
||||||
|
username = this->getUser();
|
||||||
|
cfg = cfgfile->getConfig(username);
|
||||||
|
if( cfg.server != "" ) url = cfg.server;
|
||||||
|
|
||||||
|
Logger::log(Logger::DEBUG,"now I know which Config to use");
|
||||||
|
|
||||||
|
XMLRPCrequest.execCall(this,username,url,cfgfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// XML Parser stuff
|
||||||
|
Element* Transaction::stepin(int count,Element* value) {
|
||||||
|
if( count<= 0 ) return value;
|
||||||
|
for( ; count > 0; count-- )
|
||||||
|
if(value->m_nodes[0]->m_type == xmlParser::ELEMENT ) value = (Element*)value->m_nodes[0];
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Transaction::getContent(Element* value) {
|
||||||
|
while( value->m_nodes.size() > 0 && value->m_nodes[0]->m_type == xmlParser::ELEMENT ) value = (Element*)value->m_nodes[0];
|
||||||
|
|
||||||
|
if( value->m_nodes.size() > 0 ) {
|
||||||
|
Text* txt = (Text*)value->m_nodes[0];
|
||||||
|
|
||||||
|
if( value->m_name == "boolean") {
|
||||||
|
int b = boost::lexical_cast<int>(replaceEntities(txt->m_content));
|
||||||
|
return (b == 0)?"false":"true";
|
||||||
|
} else if( value->m_name == "dateTime.iso8601") {
|
||||||
|
string datestring = replaceEntities(txt->m_content);
|
||||||
|
string year = datestring.substr(0,4);
|
||||||
|
string month = datestring.substr(4,2);
|
||||||
|
string day = datestring.substr(6,2);
|
||||||
|
string hour = datestring.substr(9,2);
|
||||||
|
string minute= datestring.substr(12,2);
|
||||||
|
string second= datestring.substr(15,2);
|
||||||
|
return day+"."+month+"."+year+" "+hour+":"+minute+":"+second;
|
||||||
|
} else if( value->m_name == "base64") {
|
||||||
|
string encoded = replaceEntities(txt->m_content);
|
||||||
|
string decoded;
|
||||||
|
char next = '\0';
|
||||||
|
int shift = 0;
|
||||||
|
while( encoded.size() ) {
|
||||||
|
int d = encoded[0];
|
||||||
|
encoded = encoded.substr(1,encoded.size()-1);
|
||||||
|
if ( d >= 'A' && d <= 'Z') d -= 'A';
|
||||||
|
else if ( d >= 'a' && d <= 'z') d = (d-'a')+26;
|
||||||
|
else if ( d >= '0' && d <= '9') d = (d-'0')+52;
|
||||||
|
else if ( d == '+') d = 62;
|
||||||
|
else if ( d == '/') d = 63;
|
||||||
|
else continue;
|
||||||
|
|
||||||
|
next += d << shift;
|
||||||
|
if( !shift ) { decoded += (char)(next&255); next = next >> 8; }
|
||||||
|
|
||||||
|
shift = (shift-2)%8;
|
||||||
|
}
|
||||||
|
if( shift ) decoded += next;
|
||||||
|
return decoded;
|
||||||
|
} else {
|
||||||
|
return replaceEntities(txt->m_content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Transaction::handleElem(Element * elem) {
|
||||||
|
if( m_tagstack.size() == 0 ) {
|
||||||
|
m_docelem = elem;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Element *array, *data;
|
||||||
|
int tab = 8;
|
||||||
|
|
||||||
|
switch( m_tagstack.size() ) {
|
||||||
|
case 6: // fill next call
|
||||||
|
if(elem->m_name != "value" ) break;
|
||||||
|
array = (Element*)(elem->m_nodes[0]);
|
||||||
|
|
||||||
|
if( array->m_name == "struct" ) {
|
||||||
|
map<string,string> errorstruct;
|
||||||
|
if(array->m_nodes.size() != 0) for(vector<Node*>::iterator n = array->m_nodes.begin(); n != array->m_nodes.end(); n++) {
|
||||||
|
Element* member = (Element*)(*n);
|
||||||
|
if(member->m_nodes.size() >= 2) {
|
||||||
|
Element *name, *value;
|
||||||
|
name = (Element*)member->m_nodes[0];
|
||||||
|
if( name->m_name == "value" ) {
|
||||||
|
value = name;
|
||||||
|
name = (Element*)member->m_nodes[1];
|
||||||
|
} else
|
||||||
|
value = (Element*)member->m_nodes[1];
|
||||||
|
|
||||||
|
while( name->m_nodes.size() > 0 && name->m_nodes[0]->m_type == xmlParser::ELEMENT ) name = (Element*)name->m_nodes[0];
|
||||||
|
while( value->m_nodes.size() > 0 && value->m_nodes[0]->m_type == xmlParser::ELEMENT ) value = (Element*)value->m_nodes[0];
|
||||||
|
if( value->m_nodes.size() > 0 && name->m_nodes.size() > 0 ) {
|
||||||
|
string namtxt = getContent(name);
|
||||||
|
string valtxt = getContent(value);
|
||||||
|
errorstruct[namtxt] = valtxt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::ServerErrorCode);
|
||||||
|
|
||||||
|
int errnum = boost::lexical_cast<int>(errorstruct["errorcode"]);
|
||||||
|
string errorstring = Logger::getErrnoMessage(errnum);
|
||||||
|
if( errorstring != "" ) errorstruct["errorstring"] = errorstring;
|
||||||
|
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % errorstruct["errorcode"] % errorstruct["errorstring"];
|
||||||
|
Logger::log(Logger::ERROR,fmt.str());
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = (Element*)(array->m_nodes[0]);
|
||||||
|
|
||||||
|
if(data->m_nodes.size() != 0) {
|
||||||
|
vector<string> headlines;
|
||||||
|
int tabpos = 0;
|
||||||
|
vector<int> tabstops;
|
||||||
|
|
||||||
|
Element* headlinesdata = stepin(3,data);
|
||||||
|
|
||||||
|
if( m_parsed->m_call[m_currentCall]->m_display == "" ) {
|
||||||
|
if(headlinesdata->m_nodes.size() != 0) for(vector<Node*>::iterator in = headlinesdata->m_nodes.begin(); in != headlinesdata->m_nodes.end(); in++) {
|
||||||
|
string output = "";
|
||||||
|
if((*in)->m_type == xmlParser::ELEMENT ) {
|
||||||
|
output = getContent((Element*)(*in));
|
||||||
|
} else {
|
||||||
|
Text* txt = (Text*)(*in);
|
||||||
|
output = replaceEntities(txt->m_content);
|
||||||
|
}
|
||||||
|
std::cout << output;
|
||||||
|
tabstops.push_back(tabpos);
|
||||||
|
tabpos += output.length();
|
||||||
|
if( in+1 != headlinesdata->m_nodes.end() )do {
|
||||||
|
std::cout << " ";
|
||||||
|
tabpos++;
|
||||||
|
} while( tabpos % tab );
|
||||||
|
}
|
||||||
|
std::cout << "\n";
|
||||||
|
for(;tabpos;tabpos--) std::cout << "-";
|
||||||
|
std::cout << "\n";
|
||||||
|
} else {
|
||||||
|
if(headlinesdata->m_nodes.size() != 0) for(vector<Node*>::iterator in = headlinesdata->m_nodes.begin(); in != headlinesdata->m_nodes.end(); in++) {
|
||||||
|
string headline = getContent((Element*)(*in));
|
||||||
|
if( headline != "" ) headlines.push_back( headline );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Element* contentvalue;
|
||||||
|
if(data->m_nodes[1]->m_type == xmlParser::ELEMENT ) contentvalue = (Element*)data->m_nodes[1];
|
||||||
|
else contentvalue = data;
|
||||||
|
Element* contentdata = stepin(2,contentvalue);
|
||||||
|
|
||||||
|
if(contentdata->m_nodes.size() != 0) for(vector<Node*>::iterator n = contentdata->m_nodes.begin(); n != contentdata->m_nodes.end(); n++) {
|
||||||
|
if( m_parsed->m_call[m_currentCall]->m_display == "" ) {
|
||||||
|
tabpos = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
Element* innerdata = stepin(2,(Element*)(*n));
|
||||||
|
if(innerdata->m_nodes.size() != 0) for(vector<Node*>::iterator in = innerdata->m_nodes.begin(); in != innerdata->m_nodes.end(); in++) {
|
||||||
|
string oputput = getContent((Element*)(*in));
|
||||||
|
|
||||||
|
while( tabpos < tabstops[i] ) {
|
||||||
|
std::cout << " "; tabpos++;
|
||||||
|
}
|
||||||
|
std::cout << oputput;
|
||||||
|
tabpos += oputput.length();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
std::cout << "\n";
|
||||||
|
} else {
|
||||||
|
map<string,string> values;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
Element* innerdata = stepin(2,(Element*)(*n));
|
||||||
|
if(innerdata->m_nodes.size() != 0) for(vector<Node*>::iterator in = innerdata->m_nodes.begin(); in != innerdata->m_nodes.end(); in++) {
|
||||||
|
string oputput = getContent((Element*)(*in));
|
||||||
|
|
||||||
|
if( oputput != "" ) {
|
||||||
|
values[headlines[i]] = oputput;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << m_parsed->m_call[m_currentCall]->evalDisplay(values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_currentCall++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tagstack.top().m_nodes.push_back(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Transaction::handleGlobalFaultElem(xmlParser::Element * elem) {
|
||||||
|
if( m_tagstack.size() == 0 ) {
|
||||||
|
m_docelem = elem;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Text *txt;
|
||||||
|
switch( m_tagstack.size() ) {
|
||||||
|
case 5:
|
||||||
|
if(elem->m_name == "value" )
|
||||||
|
Logger::log(Logger::FATAL,getContent(elem));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tagstack.top().m_nodes.push_back(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
string Transaction::replaceEntities(const string &input) {
|
||||||
|
string rval;
|
||||||
|
for( string::const_iterator i = input.begin(); i != input.end(); i++ ) {
|
||||||
|
if( *i != '&' ) rval += *i;
|
||||||
|
else {
|
||||||
|
string tmp;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
for( j = 1; *(i+j) != ';' && i+j != input.end(); j++ ) tmp += *(i+j);
|
||||||
|
|
||||||
|
if( *(i+j) != ';' ) { rval += "&"; continue; }
|
||||||
|
|
||||||
|
if( tmp == "amp" ) {
|
||||||
|
rval += "&";
|
||||||
|
i+=j;
|
||||||
|
} else if( tmp == "gt" ) {
|
||||||
|
rval += ">";
|
||||||
|
i+=j;
|
||||||
|
} else if( tmp == "lt" ) {
|
||||||
|
rval += "<";
|
||||||
|
i+=j;
|
||||||
|
} else if( tmp == "quot" ) {
|
||||||
|
rval += "\"";
|
||||||
|
i+=j;
|
||||||
|
} else if( tmp == "apos" ) {
|
||||||
|
rval += "'";
|
||||||
|
i+=j;
|
||||||
|
} else if( tmp[0] == '#' ) {
|
||||||
|
if( tmp[1] != 'x' ) {
|
||||||
|
wchar_t value[2];
|
||||||
|
value[0] = lexical_cast<int>(tmp.substr(1));
|
||||||
|
value[1] = 0;
|
||||||
|
char u[255];
|
||||||
|
bzero(u,255);
|
||||||
|
|
||||||
|
wcstombs(u,value,254);
|
||||||
|
rval += u;
|
||||||
|
i+=j;
|
||||||
|
} else {
|
||||||
|
wchar_t value[2];
|
||||||
|
value[0] = 0;
|
||||||
|
value[1] = 0;
|
||||||
|
if ( tmp[2] >= '0' && tmp[2] <= '9' ) value[0] = tmp[2]-'0';
|
||||||
|
else if( tmp[2] >= 'a' && tmp[2] <= 'f' ) value[0] = tmp[2]-'a';
|
||||||
|
else if( tmp[2] >= 'A' && tmp[2] <= 'F' ) value[0] = tmp[2]-'A';
|
||||||
|
else { rval += "&"; continue;}
|
||||||
|
value[0] = value[0] << 4;
|
||||||
|
if ( tmp[3] >= '0' && tmp[3] <= '9' ) value[0] += tmp[3]-'0';
|
||||||
|
else if( tmp[3] >= 'a' && tmp[3] <= 'f' ) value[0] += tmp[3]-'a';
|
||||||
|
else if( tmp[3] >= 'A' && tmp[3] <= 'F' ) value[0] += tmp[3]-'A';
|
||||||
|
else { rval += "&"; continue; }
|
||||||
|
char u[255];
|
||||||
|
bzero(u,255);
|
||||||
|
|
||||||
|
wcstombs(u,value,254);
|
||||||
|
rval += u;
|
||||||
|
i+=j;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rval += "&";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Transaction::operator()(int type, string content) {
|
||||||
|
string tmp;
|
||||||
|
Element elem, currentelem;
|
||||||
|
Text text;
|
||||||
|
|
||||||
|
switch( type ) {
|
||||||
|
case responseParserHook::ELEMENT:
|
||||||
|
break;
|
||||||
|
case responseParserHook::ATTRIBUTE:
|
||||||
|
m_nextAttributeList[content] = m_nextAttributeValue;
|
||||||
|
m_nextAttributeValue = "";
|
||||||
|
break;
|
||||||
|
case responseParserHook::TEXT:
|
||||||
|
if( m_tagstack.size() ) {
|
||||||
|
m_tagstack.top().m_nodes.push_back(new Text(content));
|
||||||
|
} else return false;
|
||||||
|
break;
|
||||||
|
case responseParserHook::CDATA:
|
||||||
|
if( m_tagstack.size() ) {
|
||||||
|
m_tagstack.top().m_nodes.push_back(new Text(content));
|
||||||
|
} else return false;
|
||||||
|
break;
|
||||||
|
case responseParserHook::PROCESSING_INSTRUCTION:
|
||||||
|
if( m_nextAttributeList["version"] != "1.0" || content != "xml" ) return false;
|
||||||
|
tmp = "";
|
||||||
|
for(map<string,string>::iterator i = m_nextAttributeList.begin(); i != m_nextAttributeList.end(); i++)
|
||||||
|
tmp += " "+(i->first)+"="+(i->second);
|
||||||
|
m_nextAttributeList.clear();
|
||||||
|
break;
|
||||||
|
case responseParserHook::COMMENT:
|
||||||
|
break;
|
||||||
|
case responseParserHook::DOCUMENT:
|
||||||
|
break;
|
||||||
|
case responseParserHook::START_ELEMENT:
|
||||||
|
if(m_tagstack.size() == 1 && content == "fault") m_globalFault = true;
|
||||||
|
elem = Element(content,m_nextAttributeList,vector<Node*>());
|
||||||
|
m_nextAttributeList.clear();
|
||||||
|
m_tagstack.push(elem);
|
||||||
|
break;
|
||||||
|
case responseParserHook::END_ELEMENT:
|
||||||
|
currentelem = m_tagstack.top();
|
||||||
|
m_tagstack.pop();
|
||||||
|
if( currentelem.m_name != content ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if( !m_globalFault ) handleElem(new Element(currentelem));
|
||||||
|
else handleGlobalFaultElem(new Element(currentelem));
|
||||||
|
break;
|
||||||
|
case responseParserHook::EMPTY_ELEMENT:
|
||||||
|
if(m_tagstack.size() == 1 && content == "fault") m_globalFault = true;
|
||||||
|
if( !m_globalFault ) handleElem(new Element(content,m_nextAttributeList,vector<Node*>()));
|
||||||
|
else handleGlobalFaultElem(new Element(content,m_nextAttributeList,vector<Node*>()));
|
||||||
|
m_nextAttributeList.clear();
|
||||||
|
break;
|
||||||
|
case responseParserHook::ATTRIBUTE_VALUE:
|
||||||
|
m_nextAttributeValue = content;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
string msg = Logger::getMessageFormatString(Logger::UnknownCallbackInXMLParser);
|
||||||
|
boost::format fmt(msg);
|
||||||
|
fmt % type % content;
|
||||||
|
Logger::log(Logger::FATAL,fmt.str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
77
hsacppcli/hsadminc/source/transaction.h
Normal file
77
hsacppcli/hsadminc/source/transaction.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "cmdlineparser.h"
|
||||||
|
#include "xmlparser.h"
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <stack>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#ifndef HSADMIN_TRANSACTION
|
||||||
|
#define HSADMIN_TRANSACTION
|
||||||
|
|
||||||
|
using boost::shared_ptr;
|
||||||
|
using std::stack;
|
||||||
|
using std::map;
|
||||||
|
using std::vector;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
//! encapsulates a transaction.
|
||||||
|
class Transaction:
|
||||||
|
public abstractcommandlineparser::CmdLineParser<commandline::Parameters,commandline::parsedParameters>,
|
||||||
|
public xmlParser::responseParserHook {
|
||||||
|
public:
|
||||||
|
//! parses all the commandline-Parameters
|
||||||
|
Transaction(vector<string> options);
|
||||||
|
|
||||||
|
string& getUser() { return m_parsed->m_user; };
|
||||||
|
//! actually execute the transaction - just needs the config and does everything else for you
|
||||||
|
void operator()(shared_ptr<ConfigFileParser> cfgfile);
|
||||||
|
|
||||||
|
//! callback for XML-Parser
|
||||||
|
virtual bool operator()(int type, string content);
|
||||||
|
|
||||||
|
//! returns the parsed parameters
|
||||||
|
shared_ptr<commandline::parsedParameters> getParsed() { return m_parsed; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_globalFault;
|
||||||
|
int m_currentCall;
|
||||||
|
stack<xmlParser::Element> m_tagstack;
|
||||||
|
string m_nextAttributeValue;
|
||||||
|
map<string,string> m_nextAttributeList;
|
||||||
|
|
||||||
|
void handleElem(xmlParser::Element * elem);
|
||||||
|
void handleGlobalFaultElem(xmlParser::Element * elem);
|
||||||
|
|
||||||
|
string replaceEntities(const string &input);
|
||||||
|
string getContent(xmlParser::Element* value);
|
||||||
|
xmlParser::Element* stepin(int count,xmlParser::Element* value);
|
||||||
|
|
||||||
|
public:
|
||||||
|
xmlParser::Element *m_docelem;
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class Transaction;
|
||||||
|
#endif /* HSADMIN_TRANSACTION */
|
209
hsacppcli/hsadminc/source/xmlparser.cpp
Normal file
209
hsacppcli/hsadminc/source/xmlparser.cpp
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "xmlparser.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
namespace xmlParser {
|
||||||
|
|
||||||
|
bool parser::operator()(const string& content, int &pos, responseParserHook *hook) { return false; }
|
||||||
|
|
||||||
|
bool spaceParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
if( content[pos] == ' ' || content[pos] == '\t' || content[pos] == '\n' || content[pos] == '\r' ) {
|
||||||
|
pos++; return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool commentParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content.substr(pos,4) == "<!--" ) {
|
||||||
|
pos+= 4;
|
||||||
|
while( content.substr(pos,3) != "-->" && pos < content.length() ) pos++;
|
||||||
|
if(pos < content.length()) {
|
||||||
|
pos += 3; return (*hook)(8,content.substr(oldpos+4,(pos-oldpos)-7));
|
||||||
|
}
|
||||||
|
pos = oldpos;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nameParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( !( (content[pos] >= '0' && content[pos] <= '9' ) ||
|
||||||
|
(content[pos] >= 'a' && content[pos] <= 'z' ) ||
|
||||||
|
(content[pos] >= 'A' && content[pos] <= 'Z' ) ||
|
||||||
|
content[pos] == '.' ||
|
||||||
|
content[pos] == ':' ||
|
||||||
|
content[pos] == '_' ) )
|
||||||
|
return false;
|
||||||
|
while( (content[pos] >= '0' && content[pos] <= '9' ) ||
|
||||||
|
(content[pos] >= 'a' && content[pos] <= 'z' ) ||
|
||||||
|
(content[pos] >= 'A' && content[pos] <= 'Z' ) ||
|
||||||
|
content[pos] == '.' ||
|
||||||
|
content[pos] == ':' ||
|
||||||
|
content[pos] == '_' ) pos++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool attributeValueParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content[pos] == '"' ) {
|
||||||
|
pos++;
|
||||||
|
while( content[pos] != '"' && pos < content.length() ) pos++;
|
||||||
|
if( pos >= content.length() ) { pos = oldpos; return false; }
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
else if( content[pos] == '\'' ) {
|
||||||
|
pos++;
|
||||||
|
while( content[pos] != '\'' && pos < content.length() ) pos++;
|
||||||
|
if( pos >= content.length() ) { pos = oldpos; return false; }
|
||||||
|
pos++;
|
||||||
|
} else {
|
||||||
|
pos = oldpos;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (*hook)(32,content.substr(oldpos+1,(pos-oldpos)-2));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool attributeParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( ! space(content,pos,hook) ) return false;
|
||||||
|
while(space(content,pos,hook) && pos < content.length() );
|
||||||
|
int namestartpos = pos;
|
||||||
|
if( ! name(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
int nameendpos = pos;
|
||||||
|
if( content[pos] != '=' ) { pos = oldpos; return false; }
|
||||||
|
pos++;
|
||||||
|
if( ! value(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
return (*hook)(2,content.substr(oldpos+1,(nameendpos-oldpos)-1));
|
||||||
|
};
|
||||||
|
|
||||||
|
bool emptyelemParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content[pos] != '<' ) return false;
|
||||||
|
pos++;
|
||||||
|
if( !name(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
int nameendpos = pos;
|
||||||
|
|
||||||
|
while(attrib(content,pos,hook) && pos < content.length() );
|
||||||
|
while(space(content,pos,hook) && pos < content.length() );
|
||||||
|
if( content.substr(pos,2) != "/>" ) { pos = oldpos; return false; }
|
||||||
|
pos += 2;
|
||||||
|
return (*hook)(18,content.substr(oldpos+1,(nameendpos-oldpos)-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool startelemParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content[pos] != '<' ) return false;
|
||||||
|
pos++;
|
||||||
|
if( !name(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
int nameendpos = pos;
|
||||||
|
|
||||||
|
while(attrib(content,pos,hook) && pos < content.length() );
|
||||||
|
while(space(content,pos,hook) && pos < content.length() );
|
||||||
|
if( content[pos] != '>' ) { pos = oldpos; return false; }
|
||||||
|
pos ++;
|
||||||
|
|
||||||
|
return (*hook)(16,content.substr(oldpos+1,(nameendpos-oldpos)-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool endelemParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content.substr(pos,2) != "</" ) return false;
|
||||||
|
pos += 2;
|
||||||
|
if( !name(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
int nameendpos = pos;
|
||||||
|
|
||||||
|
while(space(content,pos,hook) && pos < content.length() );
|
||||||
|
if( content[pos] != '>' ) { pos = oldpos; return false; }
|
||||||
|
pos ++;
|
||||||
|
|
||||||
|
return (*hook)(17,content.substr(oldpos+2,(nameendpos-oldpos)-2));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool textParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content[pos] == '<' )
|
||||||
|
return false;
|
||||||
|
while( content[pos] != '<' && pos < content.length() ) pos++;
|
||||||
|
return (*hook)(3,content.substr(oldpos,pos-oldpos));
|
||||||
|
};
|
||||||
|
|
||||||
|
bool cdataParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content.substr(pos,9) != "<![CDATA[" ) return false;
|
||||||
|
bool foundend = false;
|
||||||
|
while( !( foundend = (content.substr(pos,3) == "]]>") ) && pos < content.length() ) pos++;
|
||||||
|
if( !foundend ) { pos = oldpos; return false; }
|
||||||
|
pos += 3;
|
||||||
|
return (*hook)(4,content.substr(oldpos+9,(pos-oldpos)-12));
|
||||||
|
};
|
||||||
|
|
||||||
|
bool elemParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( emptyelem(content,pos,hook) ) return (*hook)(1,content.substr(oldpos,pos-oldpos));
|
||||||
|
if( ! elemstart(content,pos,hook) ) return false;
|
||||||
|
|
||||||
|
bool foundend = false;
|
||||||
|
while( !(foundend = endelem(content,pos,hook)) && pos < content.length() ) {
|
||||||
|
if( ! ( comspace(content,pos,hook) ||
|
||||||
|
text(content,pos,hook) ||
|
||||||
|
(*this)(content,pos,hook) ||
|
||||||
|
cdata(content,pos,hook) ) ) {
|
||||||
|
pos = oldpos;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( foundend ) return (*hook)(1,content.substr(oldpos,pos-oldpos));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xmlpcParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( content.substr(pos,5) != "<?xml" ) return false;
|
||||||
|
pos += 5;
|
||||||
|
|
||||||
|
while(attrib(content,pos,hook) && pos < content.length() );
|
||||||
|
while(space(content,pos,hook) && pos < content.length() );
|
||||||
|
if( content.substr(pos,2) != "?>" ) { pos = oldpos; return false; }
|
||||||
|
pos += 2;
|
||||||
|
return (*hook)(7,string("xml"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XMLParser::operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
while(space(content,pos,hook) && pos < content.length() );
|
||||||
|
if( ! xmlpc(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
while(comspace(content,pos,hook) && pos < content.length() );
|
||||||
|
if( ! elem(content,pos,hook) ) { pos = oldpos; return false; }
|
||||||
|
while(comspace(content,pos,hook) && pos < content.length() );
|
||||||
|
return (*hook)(9,content.substr(oldpos,pos-oldpos));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ResponseParser::operator()(const string& content, responseParserHook *hook) {
|
||||||
|
int pos = 0;
|
||||||
|
bool rval = xml(content,pos,hook);
|
||||||
|
if( pos < content.length() ) return false;
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
296
hsacppcli/hsadminc/source/xmlparser.h
Normal file
296
hsacppcli/hsadminc/source/xmlparser.h
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2005 by Christof Donat *
|
||||||
|
* cdonat@gmx.de *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#ifndef HSADMIN_XMLPARSER
|
||||||
|
#define HSADMIN_XMLPARSER
|
||||||
|
|
||||||
|
/** \brief a general XML Parser
|
||||||
|
*
|
||||||
|
* well, it works for me. The API is inspired a bit by SAX, but I didn't
|
||||||
|
* whant to create the full SAX API.
|
||||||
|
*/
|
||||||
|
namespace xmlParser {
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::map;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
//! Node Types
|
||||||
|
typedef enum {
|
||||||
|
UNKNOWN = 0,
|
||||||
|
ELEMENT = 1,
|
||||||
|
ATTRIBUTE = 2,
|
||||||
|
TEXT = 3,
|
||||||
|
CDATA = 4,
|
||||||
|
PROCESSING_INSTRUCTION = 7,
|
||||||
|
COMMENT = 8,
|
||||||
|
DOCUMENT = 9,
|
||||||
|
|
||||||
|
} nodeType;
|
||||||
|
|
||||||
|
//! base class for all Nodes
|
||||||
|
class Node {
|
||||||
|
public:
|
||||||
|
Node(nodeType type): m_type(type) {};
|
||||||
|
Node(): m_type(UNKNOWN) {};
|
||||||
|
nodeType m_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Text node
|
||||||
|
class Text: public Node {
|
||||||
|
public:
|
||||||
|
Text(): m_content(""), Node::Node(TEXT) {};
|
||||||
|
//! create a Text node from a C++ String
|
||||||
|
Text(string content): m_content(content), Node::Node(TEXT) {};
|
||||||
|
//! copy-construct a Text node
|
||||||
|
Text(const Text &text): m_content(text.m_content), Node::Node(TEXT) {};
|
||||||
|
|
||||||
|
//! the actual text
|
||||||
|
string m_content;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Element node
|
||||||
|
class Element: public Node {
|
||||||
|
public:
|
||||||
|
Element():
|
||||||
|
m_nodes(vector<Node*>(0)),
|
||||||
|
m_attributes(map<string,string>()),
|
||||||
|
m_name(""),
|
||||||
|
Node::Node(ELEMENT) {};
|
||||||
|
//! create a Element from its tag-name , a List of Attributes and a List of Child-Nodes
|
||||||
|
Element(string name, map<string,string> attributes, vector<Node*> content):
|
||||||
|
m_nodes(content),
|
||||||
|
m_attributes(attributes),
|
||||||
|
m_name(name),
|
||||||
|
Node::Node(ELEMENT) {};
|
||||||
|
//! copy-construct a Element Node
|
||||||
|
Element(const Element &elm):
|
||||||
|
m_nodes(elm.m_nodes),
|
||||||
|
m_attributes(elm.m_attributes),
|
||||||
|
m_name(elm.m_name),
|
||||||
|
Node::Node(ELEMENT) {};
|
||||||
|
|
||||||
|
//! The tag name
|
||||||
|
string m_name;
|
||||||
|
//! the attributes
|
||||||
|
map<string,string> m_attributes;
|
||||||
|
//! che child nodes
|
||||||
|
vector<Node*> m_nodes;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! the XML parser calls the operator() for everything it finds
|
||||||
|
class responseParserHook {
|
||||||
|
public:
|
||||||
|
enum {
|
||||||
|
ELEMENT = 1,
|
||||||
|
ATTRIBUTE = 2,
|
||||||
|
TEXT = 3,
|
||||||
|
CDATA = 4,
|
||||||
|
PROCESSING_INSTRUCTION = 7,
|
||||||
|
COMMENT = 8,
|
||||||
|
DOCUMENT = 9,
|
||||||
|
START_ELEMENT = 16,
|
||||||
|
END_ELEMENT = 17,
|
||||||
|
EMPTY_ELEMENT = 18,
|
||||||
|
ATTRIBUTE_VALUE = 32,
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual bool operator()(int type, string content) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! a dummy Parser; the general parser base class
|
||||||
|
class parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Template to construct a Parser from two parsers.
|
||||||
|
*
|
||||||
|
* combines the results of the two parsers with 'or'.
|
||||||
|
*/
|
||||||
|
template <class first, class second> class orRule : public parser {
|
||||||
|
public:
|
||||||
|
inline bool operator()(const string& content, int &pos, responseParserHook *hook) {
|
||||||
|
int oldpos = pos;
|
||||||
|
if( !car(content,pos,hook) ) return cdr(content,pos,hook);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
first car;
|
||||||
|
second cdr;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse everything that is a space
|
||||||
|
class spaceParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse XML comments
|
||||||
|
class commentParser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse either spaces or comments
|
||||||
|
typedef orRule<spaceParser, commentParser> comspaceParser;
|
||||||
|
|
||||||
|
//! parse XML names
|
||||||
|
class nameParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse XML attribute values
|
||||||
|
class attributeValueParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse XML attributes with name and value
|
||||||
|
class attributeParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nameParser name;
|
||||||
|
spaceParser space;
|
||||||
|
attributeValueParser value;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse an empty element
|
||||||
|
class emptyelemParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nameParser name;
|
||||||
|
attributeParser attrib;
|
||||||
|
spaceParser space;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse the start of an element
|
||||||
|
class startelemParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nameParser name;
|
||||||
|
attributeParser attrib;
|
||||||
|
spaceParser space;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse the end of an element
|
||||||
|
class endelemParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nameParser name;
|
||||||
|
spaceParser space;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse Text
|
||||||
|
class textParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse CDATA-sections
|
||||||
|
class cdataParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse general Elements
|
||||||
|
class elemParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
|
||||||
|
private:
|
||||||
|
emptyelemParser emptyelem;
|
||||||
|
startelemParser elemstart;
|
||||||
|
comspaceParser comspace;
|
||||||
|
endelemParser endelem;
|
||||||
|
textParser text;
|
||||||
|
cdataParser cdata;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse the xml Processing instruction at the beginning of each XML-File
|
||||||
|
class xmlpcParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nameParser name;
|
||||||
|
attributeParser attrib;
|
||||||
|
spaceParser space;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! parse an XML-File
|
||||||
|
class XMLParser: public parser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, int &pos, responseParserHook *hook);
|
||||||
|
private:
|
||||||
|
spaceParser space;
|
||||||
|
xmlpcParser xmlpc;
|
||||||
|
comspaceParser comspace;
|
||||||
|
elemParser elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! just a convenient wraper around the XMLParser
|
||||||
|
class ResponseParser {
|
||||||
|
public:
|
||||||
|
bool operator()(const string& content, responseParserHook *hook);
|
||||||
|
private:
|
||||||
|
XMLParser xml;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* HSADMIN_XMLPARSER */
|
||||||
|
|
||||||
|
namespace xmlParser {
|
||||||
|
|
||||||
|
class responseParserHook;
|
||||||
|
class parser;
|
||||||
|
template <class first, class second> class orRule;
|
||||||
|
class spaceParser;
|
||||||
|
class commentParser;
|
||||||
|
class nameParser;
|
||||||
|
class attributeValueParser;
|
||||||
|
class attributeParser;
|
||||||
|
class emptyelemParser;
|
||||||
|
class startelemParser;
|
||||||
|
class endelemParser;
|
||||||
|
class textParser;
|
||||||
|
class cdataParser;
|
||||||
|
class elemParser;
|
||||||
|
class xmlpcParser;
|
||||||
|
class XMLParser;
|
||||||
|
class ResponseParser;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HSADMIN_XMLPARSER */
|
31
hsarback/.classpath
Normal file
31
hsarback/.classpath
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
|
<classpathentry kind="lib" path="lib/activemq-core-5.4.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-beanutils-1.8.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-dbcp-1.4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-net2-2.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-pool-1.5.4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/geronimo-j2ee-management_1.1_spec-1.0.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/geronimo-jms_1.1_spec-1.1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/geronimo-jpa_2.0_spec-1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/geronimo-jta_1.1_spec-1.1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/geronimo-validation_1.0_spec-1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/jpwgen-1.2.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/mail.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/openjpa-2.1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/org.apache.bval.bundle-0.2-incubating.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/serp-1.13.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/servlet-api-2.4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/ws-commons-util-1.0.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/xmlrpc-client-3.1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/xmlrpc-common-3.1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/xmlrpc-server-3.1.3.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
4
hsarback/.gitignore
vendored
4
hsarback/.gitignore
vendored
@ -1,6 +1,2 @@
|
|||||||
/build
|
/build
|
||||||
/bin
|
/bin
|
||||||
/.classpath
|
|
||||||
/.project
|
|
||||||
/.settings/
|
|
||||||
/target/
|
|
||||||
|
17
hsarback/.project
Normal file
17
hsarback/.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>hsarback</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
2
hsarback/.settings/org.eclipse.core.resources.prefs
Normal file
2
hsarback/.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//doc/overview-for-translatewiki-net=UTF-8
|
164
hsarback/build.xml
Normal file
164
hsarback/build.xml
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="hsarweb" default="war">
|
||||||
|
|
||||||
|
<property name="build.home" value="${basedir}/build" />
|
||||||
|
<property name="lib.home" value="${basedir}/lib" />
|
||||||
|
<property name="conf.home" value="${basedir}/conf" />
|
||||||
|
<property name="src.home" value="${basedir}/src" />
|
||||||
|
<property name="test.home" value="${basedir}/test" />
|
||||||
|
<property name="dist.home" value="${basedir}/dist" />
|
||||||
|
|
||||||
|
<property file="${user.home}/.hsar.ant.properties" />
|
||||||
|
|
||||||
|
<!-- Optionen für Java-Compiler-->
|
||||||
|
<property name="compile.debug" value="true" />
|
||||||
|
<property name="compile.deprecation" value="true" />
|
||||||
|
<property name="compile.optimize" value="true" />
|
||||||
|
|
||||||
|
<path id="compile.classpath">
|
||||||
|
<fileset dir="lib">
|
||||||
|
<include name="*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="enhance.classpath">
|
||||||
|
<fileset dir="lib">
|
||||||
|
<include name="*.jar" />
|
||||||
|
</fileset>
|
||||||
|
<dirset dir="conf"/>
|
||||||
|
<dirset dir="${build.home}"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<target name="clean" description="aufräumen">
|
||||||
|
<delete dir="${build.home}" />
|
||||||
|
<delete dir="${dist.home}" />
|
||||||
|
<delete file="webapp/WEB-INF/web.xml" />
|
||||||
|
<delete file="webapp/META-INF/context.xml" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="deploy" depends="war">
|
||||||
|
<delete dir="${hsar.deploy.dir}/hsar" />
|
||||||
|
<copy file="build/hsar.war" todir="${hsar.deploy.dir}" />
|
||||||
|
<!-- <sleep minutes="2"/> -->
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jar" depends="enhance">
|
||||||
|
<jar destfile="build/hsar.jar">
|
||||||
|
<fileset dir="build/cls"/>
|
||||||
|
<fileset dir="src">
|
||||||
|
<include name="**/*.properties"/>
|
||||||
|
<include name="**/*.jtpl"/>
|
||||||
|
</fileset>
|
||||||
|
<fileset dir="conf">
|
||||||
|
<include name="**/*.xml"/>
|
||||||
|
</fileset>
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="war" depends="enhance">
|
||||||
|
<copy file="conf/WEB-INF/${target}-web.xml" tofile="webapp/WEB-INF/web.xml">
|
||||||
|
<filterset>
|
||||||
|
<filter token="LOGIN_HOST" value="${cas.domain.name}"/>
|
||||||
|
<filter token="LOGIN_PORT" value="${cas.https.port}"/>
|
||||||
|
<filter token="CONFIG_HOST" value="${hsar.domain.name}"/>
|
||||||
|
<filter token="CONFIG_PORT" value="${hsar.https.port}"/>
|
||||||
|
</filterset>
|
||||||
|
</copy>
|
||||||
|
<copy file="conf/META-INF/${target}-context.xml" tofile="webapp/META-INF/context.xml">
|
||||||
|
</copy>
|
||||||
|
<war destfile="build/hsar.war" basedir="webapp" needxmlfile="false">
|
||||||
|
<lib dir="lib">
|
||||||
|
<include name="**/*.jar"/>
|
||||||
|
<exclude name="**/servlet*.jar"/>
|
||||||
|
<exclude name="**/geronimo-jms*.jar"/>
|
||||||
|
<exclude name="**/geronimo-j2ee-management*.jar"/>
|
||||||
|
<exclude name="**/activemq*.jar"/>
|
||||||
|
</lib>
|
||||||
|
<classes dir="build/cls" />
|
||||||
|
<classes dir="src">
|
||||||
|
<include name="**/*.properties"/>
|
||||||
|
<include name="**/*.jtpl"/>
|
||||||
|
</classes>
|
||||||
|
<classes dir="conf">
|
||||||
|
<include name="**/*.xml"/>
|
||||||
|
</classes>
|
||||||
|
</war>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" description="compilieren">
|
||||||
|
<mkdir dir="${build.home}" />
|
||||||
|
<mkdir dir="${build.home}/cls" />
|
||||||
|
<javac srcdir="${src.home}" destdir="${build.home}/cls" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="UTF8" includeantruntime="false">
|
||||||
|
<classpath refid="compile.classpath" />
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile-test" description="tests compilieren" depends="compile">
|
||||||
|
<mkdir dir="${build.home}" />
|
||||||
|
<mkdir dir="${build.home}/test" />
|
||||||
|
<javac srcdir="${test.home}" destdir="${build.home}/test" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="UTF8" includeantruntime="false">
|
||||||
|
<classpath refid="compile.classpath" />
|
||||||
|
<classpath>
|
||||||
|
<pathelement path="${compile.classpath}"/>
|
||||||
|
<pathelement location="${build.home}/cls"/>
|
||||||
|
<pathelement path="/usr/share/java/junit4.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="enhance" description="openjpa enhancer" depends="compile">
|
||||||
|
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
|
||||||
|
<classpath refid="enhance.classpath"/>
|
||||||
|
</taskdef>
|
||||||
|
<taskdef name="mappingtool" classname="org.apache.openjpa.jdbc.ant.MappingToolTask">
|
||||||
|
<classpath refid="enhance.classpath"/>
|
||||||
|
</taskdef>
|
||||||
|
<openjpac>
|
||||||
|
<classpath refid="enhance.classpath"/>
|
||||||
|
</openjpac>
|
||||||
|
<echo message="Enhancing complete."/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init-db" description="init empty database">
|
||||||
|
<sql
|
||||||
|
classpath="/usr/share/java/postgresql-jdbc3.jar"
|
||||||
|
driver="org.postgresql.Driver"
|
||||||
|
url="jdbc:postgresql://${database.host}:5432/${database.name}"
|
||||||
|
userid="${database.user}" password="${database.password}"
|
||||||
|
src="database/schema.sql" />
|
||||||
|
<sql
|
||||||
|
classpath="/usr/share/java/postgresql-jdbc3.jar"
|
||||||
|
driver="org.postgresql.Driver"
|
||||||
|
url="jdbc:postgresql://${database.host}:5432/${database.name}"
|
||||||
|
userid="${database.user}" password="${database.password}"
|
||||||
|
src="database/data.sql" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="drop-db" description="make empty database">
|
||||||
|
<sql
|
||||||
|
classpath="/usr/share/java/postgresql-jdbc3.jar"
|
||||||
|
driver="org.postgresql.Driver"
|
||||||
|
url="jdbc:postgresql://${database.host}:5432/${database.name}"
|
||||||
|
userid="${database.user}" password="${database.password}"
|
||||||
|
src="database/dropschema.sql" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="remote-test" description="inspection of xmlrpc-api" depends="compile-test">
|
||||||
|
<mkdir dir="${build.home}/junit" />
|
||||||
|
<junit printsummary="yes" fork="yes">
|
||||||
|
<jvmarg value="-Djavax.net.ssl.trustStore=${javax.net.ssl.trustStore}"/>
|
||||||
|
<jvmarg value="-Djavax.net.ssl.trustStorePassword=${javax.net.ssl.trustStorePassword}"/>
|
||||||
|
<classpath>
|
||||||
|
<fileset dir="lib">
|
||||||
|
<include name="*.jar" />
|
||||||
|
</fileset>
|
||||||
|
<pathelement location="${build.home}/cls"/>
|
||||||
|
<pathelement location="${build.home}/test"/>
|
||||||
|
<pathelement path="/usr/share/java/junit4.jar"/>
|
||||||
|
</classpath>
|
||||||
|
<formatter type="xml"/>
|
||||||
|
<test name="de.hsadmin.remote.ContinuousIntegrationTest" todir="${build.home}/junit" />
|
||||||
|
</junit>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
@ -1,9 +1,5 @@
|
|||||||
<Context path="/hsar" reloadable="true" crossContext="true">
|
<Context path="/hsar" reloadable="true" crossContext="true">
|
||||||
|
|
||||||
<Valve className="org.apache.catalina.valves.ErrorReportValve"
|
|
||||||
showReport="false"
|
|
||||||
showServerInfo="false" />
|
|
||||||
|
|
||||||
<ResourceLink
|
<ResourceLink
|
||||||
name="jdbc/HSAdminDB"
|
name="jdbc/HSAdminDB"
|
||||||
global="jdbc/HSAdminDB"
|
global="jdbc/HSAdminDB"
|
||||||
@ -15,18 +11,8 @@
|
|||||||
type="javax.jms.QueueConnectionFactory"/>
|
type="javax.jms.QueueConnectionFactory"/>
|
||||||
|
|
||||||
<ResourceLink
|
<ResourceLink
|
||||||
name="jms/hsadminSystem-h96"
|
name="jms/hsadminSystem-h99"
|
||||||
global="jms/hsadminSystem-h96"
|
global="jms/hsadminSystem-h99"
|
||||||
type="javax.jms.Queue"/>
|
|
||||||
|
|
||||||
<ResourceLink
|
|
||||||
name="jms/hsadminSystem-h97"
|
|
||||||
global="jms/hsadminSystem-h97"
|
|
||||||
type="javax.jms.Queue"/>
|
|
||||||
|
|
||||||
<ResourceLink
|
|
||||||
name="jms/hsadminSystem-h98"
|
|
||||||
global="jms/hsadminSystem-h98"
|
|
||||||
type="javax.jms.Queue"/>
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
<ResourceLink
|
<ResourceLink
|
@ -6,6 +6,8 @@
|
|||||||
<class>de.hsadmin.core.qserv.QueueTask</class>
|
<class>de.hsadmin.core.qserv.QueueTask</class>
|
||||||
<class>de.hsadmin.mods.cust.Customer</class>
|
<class>de.hsadmin.mods.cust.Customer</class>
|
||||||
<class>de.hsadmin.mods.cust.Contact</class>
|
<class>de.hsadmin.mods.cust.Contact</class>
|
||||||
|
<class>de.hsadmin.mods.cust.BankAccount</class>
|
||||||
|
<class>de.hsadmin.mods.cust.CustomersTariff</class>
|
||||||
<class>de.hsadmin.mods.pac.Pac</class>
|
<class>de.hsadmin.mods.pac.Pac</class>
|
||||||
<class>de.hsadmin.mods.pac.BasePac</class>
|
<class>de.hsadmin.mods.pac.BasePac</class>
|
||||||
<class>de.hsadmin.mods.pac.BaseComponent</class>
|
<class>de.hsadmin.mods.pac.BaseComponent</class>
|
||||||
@ -27,10 +29,6 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="openjpa.ConnectionDriverName" value="org.postgresql.Driver"/>
|
<property name="openjpa.ConnectionDriverName" value="org.postgresql.Driver"/>
|
||||||
<property name="openjpa.Compatibility" value="QuotedNumbersInQueries=true"/>
|
<property name="openjpa.Compatibility" value="QuotedNumbersInQueries=true"/>
|
||||||
|
|
||||||
<property name="openjpa.Log" value="SQL=TRACE"/>
|
|
||||||
<property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72"/>
|
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
</persistence>
|
</persistence>
|
123
hsarback/conf/META-INF/prod-context.xml
Normal file
123
hsarback/conf/META-INF/prod-context.xml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<Context path="/hsar" reloadable="true" crossContext="true">
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jdbc/HSAdminDB"
|
||||||
|
global="jdbc/HSAdminDB"
|
||||||
|
type="javax.sql.DataSource"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/QueueCF"
|
||||||
|
global="jms/QueueCF"
|
||||||
|
type="javax.jms.QueueConnectionFactory"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h01"
|
||||||
|
global="jms/hsadminSystem-h01"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h02"
|
||||||
|
global="jms/hsadminSystem-h02"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h03"
|
||||||
|
global="jms/hsadminSystem-h03"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h04"
|
||||||
|
global="jms/hsadminSystem-h04"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h05"
|
||||||
|
global="jms/hsadminSystem-h05"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h06"
|
||||||
|
global="jms/hsadminSystem-h06"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h07"
|
||||||
|
global="jms/hsadminSystem-h07"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h08"
|
||||||
|
global="jms/hsadminSystem-h08"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h50"
|
||||||
|
global="jms/hsadminSystem-h50"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h51"
|
||||||
|
global="jms/hsadminSystem-h51"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h52"
|
||||||
|
global="jms/hsadminSystem-h52"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h55"
|
||||||
|
global="jms/hsadminSystem-h55"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h56"
|
||||||
|
global="jms/hsadminSystem-h56"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h57"
|
||||||
|
global="jms/hsadminSystem-h57"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h58"
|
||||||
|
global="jms/hsadminSystem-h58"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-mail1"
|
||||||
|
global="jms/hsadminSystem-mail1"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-mail2"
|
||||||
|
global="jms/hsadminSystem-mail2"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-mail3"
|
||||||
|
global="jms/hsadminSystem-mail3"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-dns1"
|
||||||
|
global="jms/hsadminSystem-dns1"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-dns2"
|
||||||
|
global="jms/hsadminSystem-dns2"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-dns3"
|
||||||
|
global="jms/hsadminSystem-dns3"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminStatus"
|
||||||
|
global="jms/hsadminStatus"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
</Context>
|
33
hsarback/conf/META-INF/test-context.xml
Normal file
33
hsarback/conf/META-INF/test-context.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<Context path="/hsar" reloadable="true" crossContext="true">
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jdbc/HSAdminDB"
|
||||||
|
global="jdbc/HSAdminDB"
|
||||||
|
type="javax.sql.DataSource"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/QueueCF"
|
||||||
|
global="jms/QueueCF"
|
||||||
|
type="javax.jms.QueueConnectionFactory"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-h99"
|
||||||
|
global="jms/hsadminSystem-h99"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-testmail"
|
||||||
|
global="jms/hsadminSystem-testmail"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminSystem-testdns"
|
||||||
|
global="jms/hsadminSystem-testdns"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
<ResourceLink
|
||||||
|
name="jms/hsadminStatus"
|
||||||
|
global="jms/hsadminStatus"
|
||||||
|
type="javax.jms.Queue"/>
|
||||||
|
|
||||||
|
</Context>
|
@ -11,6 +11,12 @@
|
|||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>Queue Status Servlet</servlet-name>
|
<servlet-name>Queue Status Servlet</servlet-name>
|
||||||
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class>
|
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CLI Client Connector</servlet-name>
|
||||||
|
<servlet-class>de.hsadmin.cliClientConnector.CLIClientConnectorServlet</servlet-class>
|
||||||
<init-param>
|
<init-param>
|
||||||
<param-name>proxyValidateUrl</param-name>
|
<param-name>proxyValidateUrl</param-name>
|
||||||
<param-value>TestUmgebung</param-value>
|
<param-value>TestUmgebung</param-value>
|
||||||
@ -19,12 +25,98 @@
|
|||||||
<param-name>proxyServiceUrl</param-name>
|
<param-name>proxyServiceUrl</param-name>
|
||||||
<param-value>TestUmgebung</param-value>
|
<param-value>TestUmgebung</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
<load-on-startup>1</load-on-startup>
|
<init-param>
|
||||||
</servlet>
|
<param-name>Components</param-name>
|
||||||
|
<param-value>member,pac,user,domain,emailaddress,emailalias,mysqluser,mysqldb,postgresqluser,postgresqldb,q</param-value>
|
||||||
<servlet>
|
</init-param>
|
||||||
<servlet-name>Queue PacTasks Servlet</servlet-name>
|
<init-param>
|
||||||
<servlet-class>de.hsadmin.mods.pac.PacTasksServlet</servlet-class>
|
<param-name>ComponentClass_member</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.cust.Customer</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_member</param-name>
|
||||||
|
<param-value>Mitglieder</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_pac</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.pac.Pac</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_pac</param-name>
|
||||||
|
<param-value>Pakete</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_user</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.user.UnixUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_user</param-name>
|
||||||
|
<param-value>Benutzer und Postfaecher anlegen</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_domain</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.dom.Domain</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_domain</param-name>
|
||||||
|
<param-value>Domains aufschalten</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_emailaddress</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.email.EMailAddress</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_emailaddress</param-name>
|
||||||
|
<param-value>E-Mail Adressen</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_emailalias</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.email.EMailAlias</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_emailalias</param-name>
|
||||||
|
<param-value>E-Mail Aliases</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_postgresqluser</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.PgSqlUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_postgresqluser</param-name>
|
||||||
|
<param-value>PostgreSQL DB-Administrator</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_postgresqldb</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.PgSqlDatabase</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_postgresqldb</param-name>
|
||||||
|
<param-value>PostgreSQL Datenbank</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_mysqluser</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.MySqlUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_mysqluser</param-name>
|
||||||
|
<param-value>MySQL DB-Administrator</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_mysqldb</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.MySqlDatabase</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_mysqldb</param-name>
|
||||||
|
<param-value>MySQL Datenbank</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_q</param-name>
|
||||||
|
<param-value>de.hsadmin.core.qserv.QueueTask</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_q</param-name>
|
||||||
|
<param-value>Offene Aktionen</param-value>
|
||||||
|
</init-param>
|
||||||
<load-on-startup>1</load-on-startup>
|
<load-on-startup>1</load-on-startup>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
@ -37,24 +129,14 @@
|
|||||||
</init-param>
|
</init-param>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>PillarServlet</servlet-name>
|
|
||||||
<servlet-class>de.hsadmin.pillar.JsonPillarServlet</servlet-class>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>Queue Status Servlet</servlet-name>
|
<servlet-name>Queue Status Servlet</servlet-name>
|
||||||
<url-pattern>/queueStatus</url-pattern>
|
<url-pattern>/queueStatus</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>PillarServlet</servlet-name>
|
<servlet-name>CLI Client Connector</servlet-name>
|
||||||
<url-pattern>/pillar</url-pattern>
|
<url-pattern>/hsadmin/cli-interface/</url-pattern>
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>Queue PacTasks Servlet</servlet-name>
|
|
||||||
<url-pattern>/queuePacTasks</url-pattern>
|
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
@ -99,11 +181,5 @@
|
|||||||
<res-auth>Container</res-auth>
|
<res-auth>Container</res-auth>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||||
</resource-ref>
|
</resource-ref>
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-pactasks</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>Queue Status Servlet</servlet-name>
|
<servlet-name>Queue Status Servlet</servlet-name>
|
||||||
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class>
|
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CLI Client Connector</servlet-name>
|
||||||
|
<servlet-class>de.hsadmin.cliClientConnector.CLIClientConnectorServlet</servlet-class>
|
||||||
<init-param>
|
<init-param>
|
||||||
<param-name>proxyValidateUrl</param-name>
|
<param-name>proxyValidateUrl</param-name>
|
||||||
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/proxyValidate</param-value>
|
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/proxyValidate</param-value>
|
||||||
@ -19,17 +25,101 @@
|
|||||||
<param-name>proxyServiceUrl</param-name>
|
<param-name>proxyServiceUrl</param-name>
|
||||||
<param-value>https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend</param-value>
|
<param-value>https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>Components</param-name>
|
||||||
|
<param-value>member,pac,user,domain,emailaddress,emailalias,mysqluser,mysqldb,postgresqluser,postgresqldb,q</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_member</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.cust.Customer</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_member</param-name>
|
||||||
|
<param-value>Mitglieder</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_pac</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.pac.Pac</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_pac</param-name>
|
||||||
|
<param-value>Pakete</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_user</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.user.UnixUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_user</param-name>
|
||||||
|
<param-value>Benutzer und Postfaecher anlegen</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_domain</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.dom.Domain</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_domain</param-name>
|
||||||
|
<param-value>Domains aufschalten</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_emailaddress</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.email.EMailAddress</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_emailaddress</param-name>
|
||||||
|
<param-value>E-Mail Adressen</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_emailalias</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.email.EMailAlias</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_emailalias</param-name>
|
||||||
|
<param-value>E-Mail Aliases</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_postgresqluser</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.PgSqlUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_postgresqluser</param-name>
|
||||||
|
<param-value>PostgreSQL DB-Administrator</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_postgresqldb</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.PgSqlDatabase</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_postgresqldb</param-name>
|
||||||
|
<param-value>PostgreSQL Datenbank</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_mysqluser</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.MySqlUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_mysqluser</param-name>
|
||||||
|
<param-value>MySQL DB-Administrator</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_mysqldb</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.MySqlDatabase</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_mysqldb</param-name>
|
||||||
|
<param-value>MySQL Datenbank</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_q</param-name>
|
||||||
|
<param-value>de.hsadmin.core.qserv.QueueTask</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_q</param-name>
|
||||||
|
<param-value>Offene Aktionen</param-value>
|
||||||
|
</init-param>
|
||||||
<load-on-startup>1</load-on-startup>
|
<load-on-startup>1</load-on-startup>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<!--
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>Queue PacTasks Servlet</servlet-name>
|
|
||||||
<servlet-class>de.hsadmin.mods.pac.PacTasksServlet</servlet-class>
|
|
||||||
<load-on-startup>1</load-on-startup>
|
|
||||||
</servlet>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>XmlRpcServlet</servlet-name>
|
<servlet-name>XmlRpcServlet</servlet-name>
|
||||||
<servlet-class>de.hsadmin.remote.HSXmlRpcServlet</servlet-class>
|
<servlet-class>de.hsadmin.remote.HSXmlRpcServlet</servlet-class>
|
||||||
@ -39,28 +129,16 @@
|
|||||||
</init-param>
|
</init-param>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>PillarServlet</servlet-name>
|
|
||||||
<servlet-class>de.hsadmin.pillar.JsonPillarServlet</servlet-class>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>Queue Status Servlet</servlet-name>
|
<servlet-name>Queue Status Servlet</servlet-name>
|
||||||
<url-pattern>/queueStatus</url-pattern>
|
<url-pattern>/queueStatus</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>PillarServlet</servlet-name>
|
<servlet-name>CLI Client Connector</servlet-name>
|
||||||
<url-pattern>/pillar</url-pattern>
|
<url-pattern>/hsadmin/cli-interface/</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<!--
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>Queue PacTasks Servlet</servlet-name>
|
|
||||||
<url-pattern>/queuePacTasks</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>XmlRpcServlet</servlet-name>
|
<servlet-name>XmlRpcServlet</servlet-name>
|
||||||
<url-pattern>/xmlrpc/*</url-pattern>
|
<url-pattern>/xmlrpc/*</url-pattern>
|
||||||
@ -133,246 +211,6 @@
|
|||||||
<res-auth>Container</res-auth>
|
<res-auth>Container</res-auth>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||||
</resource-ref>
|
</resource-ref>
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h10</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h11</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h12</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h13</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h14</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h15</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h16</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h17</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h18</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h19</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h20</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h21</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h22</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h23</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h24</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h25</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h26</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h27</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h28</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h29</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h30</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h31</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h32</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h33</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h34</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h35</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h36</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h37</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h38</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h39</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h40</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h41</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h42</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h43</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h44</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h45</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h46</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h47</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h48</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h49</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
<resource-ref>
|
||||||
<res-ref-name>jms/hsadminSystem-h50</res-ref-name>
|
<res-ref-name>jms/hsadminSystem-h50</res-ref-name>
|
||||||
<res-type>javax.jms.Queue</res-type>
|
<res-type>javax.jms.Queue</res-type>
|
||||||
@ -391,18 +229,6 @@
|
|||||||
<res-auth>Container</res-auth>
|
<res-auth>Container</res-auth>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||||
</resource-ref>
|
</resource-ref>
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h53</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h54</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
<resource-ref>
|
||||||
<res-ref-name>jms/hsadminSystem-h55</res-ref-name>
|
<res-ref-name>jms/hsadminSystem-h55</res-ref-name>
|
||||||
<res-type>javax.jms.Queue</res-type>
|
<res-type>javax.jms.Queue</res-type>
|
||||||
@ -427,312 +253,6 @@
|
|||||||
<res-auth>Container</res-auth>
|
<res-auth>Container</res-auth>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||||
</resource-ref>
|
</resource-ref>
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h59</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h60</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h61</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h62</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h63</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h64</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h65</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h66</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h67</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h68</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h69</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h70</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h71</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h72</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h73</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h74</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h75</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h76</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h77</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h78</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h79</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h80</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h81</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h82</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h83</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h84</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h85</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h86</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h87</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h88</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h89</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h90</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h91</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h92</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h93</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h94</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h95</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h96</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h97</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h98</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-h99</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1101</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1102</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1103</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1104</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1105</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1106</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1107</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1108</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1109</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-vm1110</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
<resource-ref>
|
<resource-ref>
|
||||||
<res-ref-name>jms/hsadminSystem-dns1</res-ref-name>
|
<res-ref-name>jms/hsadminSystem-dns1</res-ref-name>
|
||||||
<res-type>javax.jms.Queue</res-type>
|
<res-type>javax.jms.Queue</res-type>
|
||||||
@ -775,17 +295,11 @@
|
|||||||
<res-auth>Container</res-auth>
|
<res-auth>Container</res-auth>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||||
</resource-ref>
|
</resource-ref>
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-pactasks</res-ref-name>
|
|
||||||
<res-type>javax.jms.Queue</res-type>
|
|
||||||
<res-auth>Container</res-auth>
|
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
|
||||||
</resource-ref>
|
|
||||||
|
|
||||||
<security-constraint>
|
<security-constraint>
|
||||||
<web-resource-collection>
|
<web-resource-collection>
|
||||||
<web-resource-name>Hostsharing Administrative Area</web-resource-name>
|
<web-resource-name>Hostsharing Administrative Area</web-resource-name>
|
||||||
<url-pattern>/xmlrpc/*</url-pattern>
|
<url-pattern>/*</url-pattern>
|
||||||
</web-resource-collection>
|
</web-resource-collection>
|
||||||
<user-data-constraint>
|
<user-data-constraint>
|
||||||
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>Queue Status Servlet</servlet-name>
|
<servlet-name>Queue Status Servlet</servlet-name>
|
||||||
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class>
|
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CLI Client Connector</servlet-name>
|
||||||
|
<servlet-class>de.hsadmin.cliClientConnector.CLIClientConnectorServlet</servlet-class>
|
||||||
<init-param>
|
<init-param>
|
||||||
<param-name>proxyValidateUrl</param-name>
|
<param-name>proxyValidateUrl</param-name>
|
||||||
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/proxyValidate</param-value>
|
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/proxyValidate</param-value>
|
||||||
@ -19,12 +25,98 @@
|
|||||||
<param-name>proxyServiceUrl</param-name>
|
<param-name>proxyServiceUrl</param-name>
|
||||||
<param-value>https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend</param-value>
|
<param-value>https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
<load-on-startup>1</load-on-startup>
|
<init-param>
|
||||||
</servlet>
|
<param-name>Components</param-name>
|
||||||
|
<param-value>member,pac,user,domain,emailaddress,emailalias,mysqluser,mysqldb,postgresqluser,postgresqldb,q</param-value>
|
||||||
<servlet>
|
</init-param>
|
||||||
<servlet-name>Queue PacTasks Servlet</servlet-name>
|
<init-param>
|
||||||
<servlet-class>de.hsadmin.mods.pac.PacTasksServlet</servlet-class>
|
<param-name>ComponentClass_member</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.cust.Customer</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_member</param-name>
|
||||||
|
<param-value>Mitglieder</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_pac</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.pac.Pac</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_pac</param-name>
|
||||||
|
<param-value>Pakete</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_user</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.user.UnixUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_user</param-name>
|
||||||
|
<param-value>Benutzer und Postfaecher anlegen</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_domain</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.dom.Domain</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_domain</param-name>
|
||||||
|
<param-value>Domains aufschalten</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_emailaddress</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.email.EMailAddress</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_emailaddress</param-name>
|
||||||
|
<param-value>E-Mail Adressen</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_emailalias</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.email.EMailAlias</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_emailalias</param-name>
|
||||||
|
<param-value>E-Mail Aliases</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_postgresqluser</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.PgSqlUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_postgresqluser</param-name>
|
||||||
|
<param-value>PostgreSQL DB-Administrator</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_postgresqldb</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.PgSqlDatabase</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_postgresqldb</param-name>
|
||||||
|
<param-value>PostgreSQL Datenbank</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_mysqluser</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.MySqlUser</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_mysqluser</param-name>
|
||||||
|
<param-value>MySQL DB-Administrator</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_mysqldb</param-name>
|
||||||
|
<param-value>de.hsadmin.mods.db.MySqlDatabase</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_mysqldb</param-name>
|
||||||
|
<param-value>MySQL Datenbank</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentClass_q</param-name>
|
||||||
|
<param-value>de.hsadmin.core.qserv.QueueTask</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>ComponentDescription_q</param-name>
|
||||||
|
<param-value>Offene Aktionen</param-value>
|
||||||
|
</init-param>
|
||||||
<load-on-startup>1</load-on-startup>
|
<load-on-startup>1</load-on-startup>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
@ -37,19 +129,14 @@
|
|||||||
</init-param>
|
</init-param>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>PillarServlet</servlet-name>
|
|
||||||
<servlet-class>de.hsadmin.pillar.JsonPillarServlet</servlet-class>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>Queue Status Servlet</servlet-name>
|
<servlet-name>Queue Status Servlet</servlet-name>
|
||||||
<url-pattern>/queueStatus</url-pattern>
|
<url-pattern>/queueStatus</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>PillarServlet</servlet-name>
|
<servlet-name>CLI Client Connector</servlet-name>
|
||||||
<url-pattern>/pillar</url-pattern>
|
<url-pattern>/hsadmin/cli-interface/</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
@ -57,11 +144,6 @@
|
|||||||
<url-pattern>/xmlrpc/*</url-pattern>
|
<url-pattern>/xmlrpc/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>Queue PacTasks Servlet</servlet-name>
|
|
||||||
<url-pattern>/queuePacTasks</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
<resource-ref>
|
<resource-ref>
|
||||||
<res-ref-name>jdbc/HSAdminDB</res-ref-name>
|
<res-ref-name>jdbc/HSAdminDB</res-ref-name>
|
||||||
<res-type>javax.sql.DataSource</res-type>
|
<res-type>javax.sql.DataSource</res-type>
|
||||||
@ -99,11 +181,15 @@
|
|||||||
<res-auth>Container</res-auth>
|
<res-auth>Container</res-auth>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||||
</resource-ref>
|
</resource-ref>
|
||||||
<resource-ref>
|
|
||||||
<res-ref-name>jms/hsadminSystem-pactasks</res-ref-name>
|
<security-constraint>
|
||||||
<res-type>javax.jms.Queue</res-type>
|
<web-resource-collection>
|
||||||
<res-auth>Container</res-auth>
|
<web-resource-name>Hostsharing Administrative Area</web-resource-name>
|
||||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
<url-pattern>/*</url-pattern>
|
||||||
</resource-ref>
|
</web-resource-collection>
|
||||||
|
<user-data-constraint>
|
||||||
|
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
||||||
|
</user-data-constraint>
|
||||||
|
</security-constraint>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||||
java.naming.provider.url=tcp://localhost:61616
|
java.naming.provider.url=ssl://config-test.ostwall195.de:61617
|
||||||
connectionFactoryNames=QueueCF
|
connectionFactoryNames=QueueCF
|
||||||
queue.hsadminSystem-h99=queue.hsadminSystem-h99
|
queue.hsadminSystem-h81=queue.hsadminSystem-h81
|
||||||
queue.hsadminStatus=queue.hsadminStatus
|
queue.hsadminStatus=queue.hsadminStatus
|
@ -1,5 +1,5 @@
|
|||||||
hsadmin.jms.factory=QueueCF
|
hsadmin.jms.factory=QueueCF
|
||||||
hsadmin.jms.system-queue=hsadminSystem-h99
|
hsadmin.jms.system-queue=hsadminSystem-h81
|
||||||
hsadmin.jms.status-queue=hsadminStatus
|
hsadmin.jms.status-queue=hsadminStatus
|
||||||
hsadmin.jms.username=user-h99
|
hsadmin.jms.username=user-h81
|
||||||
hsadmin.jms.password=GrIo3Z
|
hsadmin.jms.password=geheim
|
||||||
|
@ -1,94 +1,72 @@
|
|||||||
--
|
--
|
||||||
-- Table: basepacket
|
-- Table: basepacket
|
||||||
--
|
--
|
||||||
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
INSERT INTO basepacket (basepacket_code, description, sorting, valid)
|
||||||
VALUES ('PAC/DW', 'Dynamic-Web/Base', 300, true, 100);
|
VALUES ('DW/B', 'Dynamic-Web/Base', 100, true);
|
||||||
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
INSERT INTO basepacket (basepacket_code, description, sorting, valid)
|
||||||
VALUES ('PAC/SW', 'Static-Web/Base', 400, true, 200);
|
VALUES ('SW/B', 'Static-Web/Base', 200, true);
|
||||||
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
|
||||||
VALUES ('PAC/WEB', 'Web/Base', 100, true, 300);
|
|
||||||
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
|
||||||
VALUES ('SRV/MGD', 'Managed Server', 200, true, 400);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table: basecomponent
|
-- Table: basecomponent
|
||||||
--
|
--
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
||||||
VALUES ('MULTI', 'Accounts', 100, true);
|
VALUES ('TRAFFIC', 'Monatliches Datenvolumen in GB', 100, true);
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
||||||
VALUES ('TRAFFIC', 'Monatliches Datenvolumen in GB', 200, true);
|
VALUES ('QUOTA', 'Festplattenspeicherplatz in MB', 200, true);
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
||||||
VALUES ('QUOTA', 'Festplattenspeicherplatz in MB', 300, true);
|
VALUES ('TOMCAT', 'Nutzung eines eigenen Tomcat-Servers', 300, true);
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
||||||
VALUES ('DAEMON', 'Nutzung eines eigenen Servers/Daemons', 400, true);
|
VALUES ('ZOPE', 'Nutzung eines eigenen Zope-Servers', 310, true);
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
||||||
VALUES ('MIRROR', 'Echtzeitspiegelung der Daten', 500, true);
|
VALUES ('APACHE', 'Nutzung eines eigenen Apache-Servers', 310, true);
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
|
||||||
VALUES ('BACKUP', 'Nächtliches Backup', 600, true);
|
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
|
||||||
VALUES ('DISK', 'Nächtliches Backup', 700, true);
|
|
||||||
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
|
|
||||||
VALUES ('CPU', 'Nächtliches Backup', 800, true);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table: component
|
-- Table: component
|
||||||
--
|
--
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 1, 10, 1, 1, 1, false, 100 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='MULTI';
|
SELECT basepacket_id, basecomponent_id, 128, 40960, 128, 128, 128, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='QUOTA';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 1, 10, 1, 1, 1, false, 200 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND basecomponent_code='MULTI';
|
SELECT basepacket_id, basecomponent_id, 512, 40960, 512, 512, 512, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='QUOTA';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 1, 10, 1, 1, 1, false, 300 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='MULTI';
|
SELECT basepacket_id, basecomponent_id, 2, 40960, 2, 2, 2, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='TRAFFIC';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 128, 40960, 128, 128, 128, false, 101 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='QUOTA';
|
SELECT basepacket_id, basecomponent_id, 4, 40960, 4, 4, 4, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='TRAFFIC';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 512, 40960, 512, 512, 512, false, 201 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND basecomponent_code='QUOTA';
|
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='TOMCAT';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 512, 40960, 512, 512, 0, false, 301 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='QUOTA';
|
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='TOMCAT';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 2, 40960, 2, 2, 2, false, 102 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='TRAFFIC';
|
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='ZOPE';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 4, 40960, 4, 4, 4, false, 202 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND basecomponent_code='TRAFFIC';
|
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='ZOPE';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 5, 40960, 5, 5, 0, false, 302 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='TRAFFIC';
|
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='APACHE';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false, 103 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='DAEMON';
|
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='APACHE';
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false, 303 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='DAEMON';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 104 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='MIRROR';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 204 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND basecomponent_code='MIRROR';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 304 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='MIRROR';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 105 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='BACKUP';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 205 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND basecomponent_code='BACKUP';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 305 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='BACKUP';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 25, 100, 25, 25, 0, false, 410 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND basecomponent_code='DISK';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 1, 16, 1, 1, 0, false, 420 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND basecomponent_code='CPU';
|
|
||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
|
||||||
SELECT basepacket_id, basecomponent_id, 10, 1000, 10, 10, 0, false, 430 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND basecomponent_code='TRAFFIC';
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table: business_partner
|
-- Table: business_partner
|
||||||
--
|
--
|
||||||
INSERT INTO business_partner (member_id, member_code, member_since, shares_signed, free, indicator_vat, exempt_vat)
|
INSERT INTO business_partner (member_id, member_code, member_since, shares_signed)
|
||||||
VALUES (10000, 'hsh00-hsh', current_date, 0, TRUE, 'NET', FALSE);
|
VALUES (10000, 'hsh00-hsh', current_date, 0);
|
||||||
INSERT INTO business_partner (member_id, member_code, member_since, shares_signed, free, indicator_vat, exempt_vat)
|
|
||||||
VALUES (20000, 'hsh00-aaa', current_date, 0, TRUE, 'NET', FALSE);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- table: contact
|
-- table: contact
|
||||||
--
|
--
|
||||||
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
|
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
|
||||||
SELECT bp_id, 'Herr', 'Uwe', 'Mueller', 'Hostsharing eG', 'service@hostsharing.net' FROM business_partner WHERE member_id=10000;
|
SELECT bp_id, 'Herr', 'Uwe', 'Mueller', 'Hostsharing eG', 'service@hostsharing.net' FROM business_partner WHERE member_id=10000;
|
||||||
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
|
|
||||||
SELECT bp_id, 'Herr', 'Ömer-Günther', 'Janßen-Müller', '', 'test@example.net' FROM business_partner WHERE member_id=20000;
|
--
|
||||||
|
-- table: bank_account
|
||||||
|
--
|
||||||
|
INSERT INTO bank_account (bp_id)
|
||||||
|
SELECT bp_id FROM business_partner WHERE member_id=10000;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- table: billdata
|
||||||
|
--
|
||||||
|
INSERT INTO billdata (bp_id)
|
||||||
|
SELECT bp_id FROM business_partner WHERE member_id=10000;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table: inet_addr
|
-- Table: inet_addr
|
||||||
@ -119,47 +97,45 @@ INSERT INTO hive (hive_name, inet_addr_id, description)
|
|||||||
--
|
--
|
||||||
-- table: packet
|
-- table: packet
|
||||||
--
|
--
|
||||||
INSERT INTO packet (packet_name, bp_id, hive_id, created, cur_inet_addr_id, free, basepacket_id)
|
INSERT INTO packet (packet_name, bp_id, hive_id, created, cur_inet_addr_id)
|
||||||
SELECT 'hsh00', business_partner.bp_id, hive.hive_id, current_date, inet_addr.inet_addr_id, true, basepacket.basepacket_id
|
SELECT 'hsh00', business_partner.bp_id, hive.hive_id, current_date, inet_addr.inet_addr_id FROM business_partner, hive, inet_addr
|
||||||
FROM business_partner, hive, inet_addr, basepacket
|
WHERE hive_name='h99' AND inet_addr = inet '176.9.242.72' AND member_id = 10000;
|
||||||
WHERE hive_name='h99' AND inet_addr = inet '176.9.242.72' AND member_id = 10000 AND basepacket.basepacket_code='PAC/WEB';
|
INSERT INTO packet (packet_name, bp_id, hive_id, created, cur_inet_addr_id)
|
||||||
INSERT INTO packet (packet_name, bp_id, hive_id, created, cur_inet_addr_id, free, basepacket_id)
|
SELECT 'hsh01', business_partner.bp_id, hive.hive_id, current_date, inet_addr.inet_addr_id FROM business_partner, hive, inet_addr
|
||||||
SELECT 'hsh01', business_partner.bp_id, hive.hive_id, current_date, inet_addr.inet_addr_id, true, basepacket.basepacket_id
|
WHERE hive_name='h99' AND inet_addr = inet '176.9.242.73' AND member_id = 10000;
|
||||||
FROM business_partner, hive, inet_addr, basepacket
|
|
||||||
WHERE hive_name='h99' AND inet_addr = inet '176.9.242.73' AND member_id = 10000 AND basepacket.basepacket_code='PAC/WEB';
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- table: packet_component
|
-- table: packet_component
|
||||||
--
|
--
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 1, packet.packet_id, 2, current_date FROM packet
|
SELECT 1, 1, packet.packet_id, 2, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh00';
|
WHERE packet.packet_name = 'hsh00';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 2, packet.packet_id, 128, current_date FROM packet
|
SELECT 1, 2, packet.packet_id, 128, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh00';
|
WHERE packet.packet_name = 'hsh00';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 3, packet.packet_id, 1, current_date FROM packet
|
SELECT 1, 3, packet.packet_id, 0, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh00';
|
WHERE packet.packet_name = 'hsh00';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 4, packet.packet_id, 1, current_date FROM packet
|
SELECT 1, 4, packet.packet_id, 0, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh00';
|
WHERE packet.packet_name = 'hsh00';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 5, packet.packet_id, 1, current_date FROM packet
|
SELECT 1, 5, packet.packet_id, 0, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh00';
|
WHERE packet.packet_name = 'hsh00';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 1, packet.packet_id, 2, current_date FROM packet
|
SELECT 1, 1, packet.packet_id, 2, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh01';
|
WHERE packet.packet_name = 'hsh01';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 2, packet.packet_id, 128, current_date FROM packet
|
SELECT 1, 2, packet.packet_id, 128, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh01';
|
WHERE packet.packet_name = 'hsh01';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 3, packet.packet_id, 1, current_date FROM packet
|
SELECT 1, 3, packet.packet_id, 0, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh01';
|
WHERE packet.packet_name = 'hsh01';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 4, packet.packet_id, 1, current_date FROM packet
|
SELECT 1, 4, packet.packet_id, 0, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh01';
|
WHERE packet.packet_name = 'hsh01';
|
||||||
INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
INSERT INTO packet_component (basepacket_id, basecomponent_id, packet_id, quantity, created)
|
||||||
SELECT 5, packet.packet_id, 1, current_date FROM packet
|
SELECT 1, 5, packet.packet_id, 0, current_date FROM packet
|
||||||
WHERE packet.packet_name = 'hsh01';
|
WHERE packet.packet_name = 'hsh01';
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -168,12 +144,6 @@ INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
|
|||||||
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
||||||
SELECT 'hsh00', 'packet hsh00', '/bin/bash', '/home/pacs/hsh00', FALSE, packet_id, 10001 FROM packet
|
SELECT 'hsh00', 'packet hsh00', '/bin/bash', '/home/pacs/hsh00', FALSE, packet_id, 10001 FROM packet
|
||||||
WHERE packet_name='hsh00';
|
WHERE packet_name='hsh00';
|
||||||
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
|
||||||
SELECT 'hsh00-hsh', 'member hsh', '/bin/bash', '/home/pacs/hsh00/users/hsh', FALSE, packet_id, 10003 FROM packet
|
|
||||||
WHERE packet_name='hsh00';
|
|
||||||
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
|
||||||
SELECT 'hsh00-aaa', 'member aaa', '/bin/bash', '/home/pacs/hsh00/users/aaa', FALSE, packet_id, 10003 FROM packet
|
|
||||||
WHERE packet_name='hsh00';
|
|
||||||
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
||||||
SELECT 'hsh01', 'packet hsh01', '/bin/bash', '/home/pacs/hsh01', FALSE, packet_id, 10002 FROM packet
|
SELECT 'hsh01', 'packet hsh01', '/bin/bash', '/home/pacs/hsh01', FALSE, packet_id, 10002 FROM packet
|
||||||
WHERE packet_name='hsh01';
|
WHERE packet_name='hsh01';
|
||||||
@ -181,13 +151,6 @@ INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
|||||||
SELECT 'hsh01-ad', 'hostmaster ad', '/bin/bash', '/home/pacs/hsh01/users/ad', FALSE, packet_id, 10003 FROM packet
|
SELECT 'hsh01-ad', 'hostmaster ad', '/bin/bash', '/home/pacs/hsh01/users/ad', FALSE, packet_id, 10003 FROM packet
|
||||||
WHERE packet_name='hsh01';
|
WHERE packet_name='hsh01';
|
||||||
|
|
||||||
--
|
|
||||||
-- table: domain
|
|
||||||
--
|
|
||||||
INSERT INTO domain (domain_name, domain_since, domain_dns_master, domain_owner)
|
|
||||||
SELECT 'hostsharing.net', current_date, 'dns.hostsharing.net', unixuser_id FROM unixuser
|
|
||||||
WHERE unixuser.name='hsh00';
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- table: domain_option
|
-- table: domain_option
|
||||||
--
|
--
|
||||||
@ -204,28 +167,4 @@ INSERT INTO domain_option (domain_option_name)
|
|||||||
INSERT INTO domain_option (domain_option_name)
|
INSERT INTO domain_option (domain_option_name)
|
||||||
VALUES ('multiviews');
|
VALUES ('multiviews');
|
||||||
INSERT INTO domain_option (domain_option_name)
|
INSERT INTO domain_option (domain_option_name)
|
||||||
VALUES ('letsencrypt');
|
VALUES ('php');
|
||||||
INSERT INTO domain_option (domain_option_name)
|
|
||||||
VALUES ('autoconfig');
|
|
||||||
INSERT INTO domain_option (domain_option_name)
|
|
||||||
VALUES ('dkim');
|
|
||||||
INSERT INTO domain_option (domain_option_name)
|
|
||||||
VALUES ('passenger');
|
|
||||||
INSERT INTO domain_option (domain_option_name)
|
|
||||||
VALUES ('passengerfriendlyerrorpages');
|
|
||||||
INSERT INTO domain_option (domain_option_name)
|
|
||||||
VALUES ('cgi');
|
|
||||||
INSERT INTO domain_option (domain_option_name)
|
|
||||||
VALUES ('fastcgi');
|
|
||||||
|
|
||||||
--
|
|
||||||
-- table: price_list
|
|
||||||
--
|
|
||||||
INSERT INTO price_list (name) VALUES ('Default Price List');
|
|
||||||
|
|
||||||
--
|
|
||||||
-- table: customer_price_list_mapping
|
|
||||||
--
|
|
||||||
INSERT INTO pricelist_ref (SELECT business_partner.bp_id, price_list.name FROM business_partner, price_list);
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1,31 @@
|
|||||||
INSERT INTO component ( basepacket_id, basecomponent_id, admin_only, article_number, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity )
|
-- Migrate database from version 2.2 to version 2.3
|
||||||
SELECT basepacket_id, basecomponent_id, false, 1023, 128, 10240, 128, 64, 0 from basepacket, basecomponent where basepacket_code='PAC/WEB' and basecomponent_code='RAM';
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- table: domain_option
|
||||||
|
--
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('php');
|
||||||
|
--
|
||||||
|
-- new domain options settings
|
||||||
|
--
|
||||||
|
-- existing default = On for DW-packet, Off otherwise.
|
||||||
|
--
|
||||||
|
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
|
||||||
|
FROM domain
|
||||||
|
JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id )
|
||||||
|
JOIN packet on ( unixuser.packet_id = packet.packet_id )
|
||||||
|
JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id )
|
||||||
|
, domain_option
|
||||||
|
WHERE basepacket.basepacket_code = 'DW/B'
|
||||||
|
AND domain_option.domain_option_name = 'php' ;
|
||||||
|
DELETE FROM domain__domain_option USING domain_option, domain
|
||||||
|
JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id )
|
||||||
|
JOIN packet on ( unixuser.packet_id = packet.packet_id )
|
||||||
|
JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id )
|
||||||
|
WHERE basepacket.basepacket_code != 'DW/B'
|
||||||
|
AND domain__domain_option.domain_option_id = domain_option.domain_option_id
|
||||||
|
AND domain_option.domain_option_name = 'php' ;
|
||||||
|
--
|
||||||
|
-- End of migration to version 2.3
|
||||||
|
--
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
DROP TABLE pricelist_ref ;
|
DROP TABLE bank_account ;
|
||||||
DROP TABLE price ;
|
DROP SEQUENCE bank_account_bank_account_id_seq ;
|
||||||
DROP TABLE price_list CASCADE ;
|
DROP TABLE billdata ;
|
||||||
DROP VIEW IF EXISTS business_partner_ticket ;
|
DROP SEQUENCE billdata_billdata_id_seq ;
|
||||||
DROP VIEW IF EXISTS ipconfig ;
|
DROP TABLE contact ;
|
||||||
DROP TABLE sepa_mandat ;
|
|
||||||
DROP SEQUENCE sepa_mandat_id_seq ;
|
|
||||||
DROP SEQUENCE contact_contact_id_seq ;
|
DROP SEQUENCE contact_contact_id_seq ;
|
||||||
DROP TABLE contact CASCADE ;
|
|
||||||
DROP TABLE database ;
|
DROP TABLE database ;
|
||||||
DROP TABLE database_user ;
|
DROP TABLE database_user ;
|
||||||
DROP SEQUENCE database_database_id_seq ;
|
DROP SEQUENCE database_database_id_seq ;
|
||||||
@ -15,19 +12,19 @@ DROP TABLE emailaddr ;
|
|||||||
DROP SEQUENCE emailaddr_emailaddr_id_seq ;
|
DROP SEQUENCE emailaddr_emailaddr_id_seq ;
|
||||||
DROP TABLE emailalias ;
|
DROP TABLE emailalias ;
|
||||||
DROP SEQUENCE emailalias_emailalias_id_seq ;
|
DROP SEQUENCE emailalias_emailalias_id_seq ;
|
||||||
|
DROP TABLE queue_task ;
|
||||||
|
DROP SEQUENCE queue_task_id_seq ;
|
||||||
DROP TABLE domain__domain_option ;
|
DROP TABLE domain__domain_option ;
|
||||||
DROP TABLE domain_option ;
|
DROP TABLE domain_option ;
|
||||||
DROP SEQUENCE domain_option_id_seq ;
|
DROP SEQUENCE domain_option_id_seq ;
|
||||||
DROP TABLE domain ;
|
DROP TABLE domain ;
|
||||||
DROP SEQUENCE domain_domain_id_seq ;
|
DROP SEQUENCE domain_domain_id_seq ;
|
||||||
DROP TABLE queue_task ;
|
DROP TABLE unixuser ;
|
||||||
DROP SEQUENCE queue_task_id_seq ;
|
|
||||||
DROP TABLE unixuser CASCADE ;
|
|
||||||
DROP SEQUENCE unixuser_unixuser_id_seq ;
|
DROP SEQUENCE unixuser_unixuser_id_seq ;
|
||||||
DROP TABLE packet_component ;
|
DROP TABLE packet_component ;
|
||||||
DROP TABLE component ;
|
DROP TABLE component ;
|
||||||
DROP TABLE basecomponent ;
|
DROP TABLE basecomponent ;
|
||||||
DROP TABLE basepacket CASCADE ;
|
DROP TABLE basepacket ;
|
||||||
DROP SEQUENCE basecomponent_basecomponent_seq ;
|
DROP SEQUENCE basecomponent_basecomponent_seq ;
|
||||||
DROP SEQUENCE basepacket_basepacket_id_seq ;
|
DROP SEQUENCE basepacket_basepacket_id_seq ;
|
||||||
DROP TABLE packet ;
|
DROP TABLE packet ;
|
||||||
@ -36,10 +33,5 @@ DROP TABLE hive ;
|
|||||||
DROP SEQUENCE hive_hive_id_seq ;
|
DROP SEQUENCE hive_hive_id_seq ;
|
||||||
DROP TABLE inet_addr ;
|
DROP TABLE inet_addr ;
|
||||||
DROP SEQUENCE inet_addr_inet_addr_id_seq ;
|
DROP SEQUENCE inet_addr_inet_addr_id_seq ;
|
||||||
DROP TABLE business_partner CASCADE ;
|
DROP TABLE business_partner ;
|
||||||
DROP SEQUENCE business_partner_bp_id_seq ;
|
DROP SEQUENCE business_partner_bp_id_seq ;
|
||||||
DROP SEQUENCE packet_component_id_seq ;
|
|
||||||
DROP SEQUENCE component_id_seq ;
|
|
||||||
DROP TABLE contactrole_ref CASCADE ;
|
|
||||||
DROP TABLE role CASCADE ;
|
|
||||||
|
|
||||||
|
@ -1,33 +1,31 @@
|
|||||||
CREATE SEQUENCE sepa_mandat_id_seq
|
--
|
||||||
|
-- Name: bank_account; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE bank_account (
|
||||||
|
bank_account_id integer DEFAULT nextval(('"bank_account_bank_account_id_seq"'::text)::regclass) NOT NULL,
|
||||||
|
bp_id integer NOT NULL,
|
||||||
|
autodebit_ga boolean,
|
||||||
|
autodebit_ar boolean,
|
||||||
|
autodebit_op boolean,
|
||||||
|
bank_customer character varying(50),
|
||||||
|
bank_account character varying(10),
|
||||||
|
bank_code character varying(8),
|
||||||
|
bank_name character varying(50),
|
||||||
|
CONSTRAINT ckt_bank_account CHECK (((((((bank_customer IS NOT NULL) AND (bank_account IS NOT NULL)) AND (bank_code IS NOT NULL)) AND (bank_name IS NOT NULL)) AND (((autodebit_ga = true) OR (autodebit_ar = true)) OR (autodebit_op = true))) OR (((autodebit_ga = false) AND (autodebit_ar = false)) AND (autodebit_op = false))))
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: bank_account_bank_account_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE bank_account_bank_account_id_seq
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
NO MAXVALUE
|
NO MAXVALUE
|
||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
CREATE TABLE sepa_mandat (
|
|
||||||
sepa_mandat_id integer NOT NULL,
|
|
||||||
bp_id integer NOT NULL,
|
|
||||||
bank_customer character varying(50) NOT NULL,
|
|
||||||
bank_name character varying(50),
|
|
||||||
bank_iban character varying(40) NOT NULL,
|
|
||||||
bank_bic character varying(40) NOT NULL,
|
|
||||||
mandat_ref character varying(40) NOT NULL,
|
|
||||||
mandat_signed date NOT NULL,
|
|
||||||
mandat_since date NOT NULL,
|
|
||||||
mandat_used date,
|
|
||||||
mandat_until date
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY sepa_mandat ALTER COLUMN sepa_mandat_id SET DEFAULT nextval('sepa_mandat_id_seq'::regclass);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY sepa_mandat
|
|
||||||
ADD CONSTRAINT pk_sepa_mandat PRIMARY KEY (sepa_mandat_id);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY sepa_mandat
|
|
||||||
ADD CONSTRAINT dateschk1 CHECK (mandat_signed <= mandat_since AND mandat_since <= mandat_until);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY sepa_mandat
|
|
||||||
ADD CONSTRAINT dateschk2 CHECK (mandat_since <= mandat_until AND mandat_since <= mandat_used AND mandat_used <= mandat_until);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: basecomponent; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: basecomponent; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
@ -57,23 +55,54 @@ CREATE SEQUENCE basecomponent_basecomponent_seq
|
|||||||
-- Name: basepacket; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: basepacket; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
|
||||||
|
CREATE TABLE basepacket (
|
||||||
|
basepacket_id integer DEFAULT nextval(('"basepacket_basepacket_id_seq"'::text)::regclass) NOT NULL,
|
||||||
|
basepacket_code character varying(10) NOT NULL,
|
||||||
|
description character varying(100) NOT NULL,
|
||||||
|
sorting integer NOT NULL,
|
||||||
|
valid boolean NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: basepacket_basepacket_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE basepacket_basepacket_id_seq
|
CREATE SEQUENCE basepacket_basepacket_id_seq
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
NO MAXVALUE
|
NO MAXVALUE
|
||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
CREATE TABLE basepacket (
|
|
||||||
basepacket_id integer DEFAULT nextval(('"basepacket_basepacket_id_seq"'::text)::regclass) NOT NULL,
|
--
|
||||||
basepacket_code character varying(10) NOT NULL,
|
-- Name: billdata; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
description character varying(100) NOT NULL,
|
--
|
||||||
article_number integer NOT NULL,
|
|
||||||
sorting integer NOT NULL,
|
CREATE TABLE billdata (
|
||||||
valid boolean NOT NULL
|
billdata_id integer DEFAULT nextval(('"billdata_billdata_id_seq"'::text)::regclass) NOT NULL,
|
||||||
|
bp_id integer NOT NULL,
|
||||||
|
tariff_domain_discount_since date,
|
||||||
|
tariff_domain_discount_until date,
|
||||||
|
tariff_traffic_discount_since date,
|
||||||
|
tariff_traffic_discount_until date,
|
||||||
|
tariff_quota_discount_since date,
|
||||||
|
tariff_quota_discount_until date,
|
||||||
|
tariff_discount_since date,
|
||||||
|
tariff_discount_until date
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE ONLY basepacket
|
|
||||||
ADD CONSTRAINT pk_basepacket PRIMARY KEY (basepacket_id);
|
--
|
||||||
|
-- Name: billdata_billdata_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE billdata_billdata_id_seq
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: business_partner; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: business_partner; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
@ -91,13 +120,9 @@ CREATE TABLE business_partner (
|
|||||||
shares_updated date,
|
shares_updated date,
|
||||||
shares_signed integer NOT NULL,
|
shares_signed integer NOT NULL,
|
||||||
uid_vat character varying(20),
|
uid_vat character varying(20),
|
||||||
free boolean NOT NULL,
|
|
||||||
indicator_vat character varying(20) NOT NULL,
|
|
||||||
exempt_vat boolean NOT NULL,
|
|
||||||
CONSTRAINT ckc_member_id_business CHECK (((member_id >= 10000) AND (member_id <= 99999))),
|
CONSTRAINT ckc_member_id_business CHECK (((member_id >= 10000) AND (member_id <= 99999))),
|
||||||
CONSTRAINT ckc_shares_signed_business CHECK ((shares_signed >= 0)),
|
CONSTRAINT ckc_shares_signed_business CHECK ((shares_signed >= 0)),
|
||||||
CONSTRAINT ckt_business_partner CHECK ( ( ((member_since IS NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NOT NULL) AND (member_since < member_until)) ) AND ((member_code)::text ~~ 'hsh00-%'::text)),
|
CONSTRAINT ckt_business_partner CHECK ( ( ((member_since IS NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NOT NULL) AND (member_since < member_until)) ) AND ((member_code)::text ~~ 'hsh00-%'::text))
|
||||||
UNIQUE (bp_id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -111,43 +136,21 @@ CREATE SEQUENCE business_partner_bp_id_seq
|
|||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
ALTER TABLE ONLY sepa_mandat
|
|
||||||
ADD CONSTRAINT fk_bank_acc_reference_business FOREIGN KEY (bp_id) REFERENCES business_partner(bp_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: component; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: component; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE component_id_seq
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MAXVALUE
|
|
||||||
NO MINVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
CREATE TABLE component (
|
CREATE TABLE component (
|
||||||
component_id integer DEFAULT nextval(('"component_id_seq"'::text)::regclass) NOT NULL,
|
|
||||||
basepacket_id integer NOT NULL,
|
basepacket_id integer NOT NULL,
|
||||||
basecomponent_id integer NOT NULL,
|
basecomponent_id integer NOT NULL,
|
||||||
article_number integer NOT NULL,
|
|
||||||
min_quantity integer NOT NULL,
|
min_quantity integer NOT NULL,
|
||||||
max_quantity integer NOT NULL,
|
max_quantity integer NOT NULL,
|
||||||
default_quantity integer NOT NULL,
|
default_quantity integer NOT NULL,
|
||||||
increment_quantity integer NOT NULL,
|
increment_quantity integer NOT NULL,
|
||||||
include_quantity integer NOT NULL,
|
include_quantity integer NOT NULL,
|
||||||
admin_only boolean NOT NULL,
|
admin_only boolean NOT NULL,
|
||||||
CONSTRAINT ckt_component CHECK (
|
CONSTRAINT ckt_component CHECK (((((((((min_quantity <= max_quantity) AND (min_quantity <= default_quantity)) AND (default_quantity <= max_quantity)) AND (min_quantity <= include_quantity)) AND (include_quantity <= max_quantity)) AND (mod(max_quantity, increment_quantity) = 0)) AND (mod(default_quantity, increment_quantity) = 0)) AND (mod(include_quantity, increment_quantity) = 0)))
|
||||||
(0 <= min_quantity) AND
|
|
||||||
(min_quantity <= default_quantity) AND
|
|
||||||
(default_quantity <= max_quantity) AND
|
|
||||||
(include_quantity <= default_quantity) AND
|
|
||||||
(0 <= include_quantity) AND
|
|
||||||
(mod(min_quantity, increment_quantity) = 0) AND
|
|
||||||
(mod(max_quantity, increment_quantity) = 0) AND
|
|
||||||
(mod(default_quantity, increment_quantity) = 0) AND
|
|
||||||
(mod(include_quantity, increment_quantity) = 0)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -176,8 +179,6 @@ CREATE TABLE contact (
|
|||||||
CONSTRAINT ckc_email_contact CHECK (((email)::text ~~ '%@%.%'::text))
|
CONSTRAINT ckc_email_contact CHECK (((email)::text ~~ '%@%.%'::text))
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE ONLY contact
|
|
||||||
ADD CONSTRAINT pk_contact PRIMARY KEY (contact_id);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: contact_contact_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
-- Name: contact_contact_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
@ -189,66 +190,6 @@ CREATE SEQUENCE contact_contact_id_seq
|
|||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
CREATE TABLE contactrole_ref (
|
|
||||||
contact_id integer NOT NULL,
|
|
||||||
role character varying(40) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY contactrole_ref
|
|
||||||
ADD CONSTRAINT pk_contactrole_ref PRIMARY KEY (contact_id, role);
|
|
||||||
|
|
||||||
CREATE TABLE role (
|
|
||||||
role_name character varying(40) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY role
|
|
||||||
ADD CONSTRAINT pk_role PRIMARY KEY (role_name);
|
|
||||||
|
|
||||||
INSERT INTO role VALUES ('billing'), ('operations');
|
|
||||||
|
|
||||||
ALTER TABLE ONLY contactrole_ref
|
|
||||||
ADD CONSTRAINT fk_contactrole_ref_role FOREIGN KEY (role) REFERENCES role(role_name);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY contactrole_ref
|
|
||||||
ADD CONSTRAINT fk_contactrole_ref_contact FOREIGN KEY (contact_id) REFERENCES contact(contact_id);
|
|
||||||
|
|
||||||
INSERT INTO contactrole_ref (contact_id, role)
|
|
||||||
( SELECT contact_id, 'billing' FROM contact );
|
|
||||||
|
|
||||||
INSERT INTO contactrole_ref (contact_id, role)
|
|
||||||
( SELECT contact_id, 'operations' FROM contact );
|
|
||||||
|
|
||||||
CREATE TABLE price_list (
|
|
||||||
id serial primary key,
|
|
||||||
name character varying(20)
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE price_list
|
|
||||||
ADD CONSTRAINT price_list_uniq_name UNIQUE (name);
|
|
||||||
|
|
||||||
CREATE TABLE pricelist_ref (
|
|
||||||
bp_id integer NOT NULL,
|
|
||||||
price_list character varying(40) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY pricelist_ref
|
|
||||||
ADD CONSTRAINT fk_pricelist_ref_bp FOREIGN KEY (bp_id) REFERENCES business_partner(bp_id) ON UPDATE RESTRICT ON DELETE CASCADE;
|
|
||||||
|
|
||||||
ALTER TABLE ONLY pricelist_ref
|
|
||||||
ADD CONSTRAINT fk_pricelist_ref_pricelist FOREIGN KEY (price_list) REFERENCES price_list(name) ON UPDATE RESTRICT ON DELETE CASCADE;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: price
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE price (
|
|
||||||
id serial primary key,
|
|
||||||
article_number integer NOT NULL,
|
|
||||||
price decimal(10, 2) NOT NULL,
|
|
||||||
vat decimal(4,2) NOT NULL,
|
|
||||||
price_list integer references price_list(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: database_database_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
-- Name: database_database_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
@ -261,6 +202,8 @@ CREATE SEQUENCE database_database_id_seq
|
|||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
SET default_with_oids = false;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: database; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: database; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -318,12 +261,7 @@ CREATE TABLE domain (
|
|||||||
domain_since date,
|
domain_since date,
|
||||||
domain_dns_master character varying(64),
|
domain_dns_master character varying(64),
|
||||||
domain_id integer DEFAULT nextval('domain_domain_id_seq'::regclass) NOT NULL,
|
domain_id integer DEFAULT nextval('domain_domain_id_seq'::regclass) NOT NULL,
|
||||||
domain_owner integer NOT NULL,
|
domain_owner integer NOT NULL
|
||||||
valid_subdomain_names character varying(256) DEFAULT 'www' NOT NULL,
|
|
||||||
passenger_python character varying(256) NULL,
|
|
||||||
passenger_nodejs character varying(256) NULL,
|
|
||||||
passenger_ruby character varying(256) NULL,
|
|
||||||
fcgi_php_bin character varying(256) NULL
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -374,6 +312,8 @@ CREATE TABLE emailalias (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
SET default_with_oids = true;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: hive; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: hive; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -424,42 +364,27 @@ CREATE SEQUENCE inet_addr_inet_addr_id_seq
|
|||||||
-- Name: packet; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: packet; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE packet_packet_id_seq
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MAXVALUE
|
|
||||||
NO MINVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
CREATE TABLE packet (
|
CREATE TABLE packet (
|
||||||
packet_id integer DEFAULT nextval(('"packet_packet_id_seq"'::text)::regclass) NOT NULL,
|
packet_id integer DEFAULT nextval(('"packet_packet_id_seq"'::text)::regclass) NOT NULL,
|
||||||
basepacket_id integer NOT NULL,
|
packet_name character varying(5) NOT NULL,
|
||||||
packet_name character varying(6) NOT NULL,
|
|
||||||
bp_id integer NOT NULL,
|
bp_id integer NOT NULL,
|
||||||
hive_id integer,
|
hive_id integer NOT NULL,
|
||||||
created date NOT NULL,
|
created date NOT NULL,
|
||||||
cancelled date,
|
cancelled date,
|
||||||
free boolean NOT NULL,
|
order_number character varying(20),
|
||||||
|
webserver_group character varying(10),
|
||||||
cur_inet_addr_id integer,
|
cur_inet_addr_id integer,
|
||||||
old_inet_addr_id integer,
|
old_inet_addr_id integer,
|
||||||
CONSTRAINT ckt_packet CHECK (((cancelled IS NULL) OR (cancelled > created)))
|
CONSTRAINT ckt_packet CHECK (((cancelled IS NULL) OR (cancelled > created)))
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE ONLY packet
|
|
||||||
ADD CONSTRAINT base_packet_ref FOREIGN KEY (basepacket_id) REFERENCES basepacket(basepacket_id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: packet_component; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: packet_component; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE packet_component_id_seq
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MAXVALUE
|
|
||||||
NO MINVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
CREATE TABLE packet_component (
|
CREATE TABLE packet_component (
|
||||||
packet_component_id integer DEFAULT nextval(('"packet_component_id_seq"'::text)::regclass) NOT NULL,
|
basepacket_id integer NOT NULL,
|
||||||
basecomponent_id integer NOT NULL,
|
basecomponent_id integer NOT NULL,
|
||||||
packet_id integer NOT NULL,
|
packet_id integer NOT NULL,
|
||||||
quantity integer NOT NULL,
|
quantity integer NOT NULL,
|
||||||
@ -469,6 +394,19 @@ CREATE TABLE packet_component (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: packet_packet_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE packet_packet_id_seq
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
SET default_with_oids = false;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: queue_task; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: queue_task; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -519,11 +457,9 @@ CREATE TABLE unixuser (
|
|||||||
homedir character varying(128) NOT NULL,
|
homedir character varying(128) NOT NULL,
|
||||||
locked boolean NOT NULL,
|
locked boolean NOT NULL,
|
||||||
packet_id integer NOT NULL,
|
packet_id integer NOT NULL,
|
||||||
userid integer NOT NULL,
|
|
||||||
quota_softlimit integer DEFAULT 0 NOT NULL,
|
quota_softlimit integer DEFAULT 0 NOT NULL,
|
||||||
|
userid integer NOT NULL,
|
||||||
quota_hardlimit integer DEFAULT 0,
|
quota_hardlimit integer DEFAULT 0,
|
||||||
storage_softlimit integer DEFAULT 0 NOT NULL,
|
|
||||||
storage_hardlimit integer DEFAULT 0,
|
|
||||||
CONSTRAINT unixuser_userid CHECK ((userid >= 10000))
|
CONSTRAINT unixuser_userid CHECK ((userid >= 10000))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -560,6 +496,14 @@ ALTER TABLE ONLY emailalias
|
|||||||
ADD CONSTRAINT emailalias_uniq UNIQUE (name);
|
ADD CONSTRAINT emailalias_uniq UNIQUE (name);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: pk_bank_account; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY bank_account
|
||||||
|
ADD CONSTRAINT pk_bank_account PRIMARY KEY (bank_account_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: pk_basecomponent; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: pk_basecomponent; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -568,6 +512,22 @@ ALTER TABLE ONLY basecomponent
|
|||||||
ADD CONSTRAINT pk_basecomponent PRIMARY KEY (basecomponent_id);
|
ADD CONSTRAINT pk_basecomponent PRIMARY KEY (basecomponent_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: pk_basepacket; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY basepacket
|
||||||
|
ADD CONSTRAINT pk_basepacket PRIMARY KEY (basepacket_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: pk_billdata; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY billdata
|
||||||
|
ADD CONSTRAINT pk_billdata PRIMARY KEY (billdata_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: pk_business_partner; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: pk_business_partner; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -581,7 +541,20 @@ ALTER TABLE ONLY business_partner
|
|||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY component
|
ALTER TABLE ONLY component
|
||||||
ADD CONSTRAINT pk_component PRIMARY KEY (component_id);
|
ADD CONSTRAINT pk_component PRIMARY KEY (basepacket_id, basecomponent_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: pk_contact; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY contact
|
||||||
|
ADD CONSTRAINT pk_contact PRIMARY KEY (contact_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: pk_database; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY database
|
ALTER TABLE ONLY database
|
||||||
ADD CONSTRAINT pk_database PRIMARY KEY (database_id);
|
ADD CONSTRAINT pk_database PRIMARY KEY (database_id);
|
||||||
@ -624,7 +597,7 @@ ALTER TABLE ONLY packet
|
|||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY packet_component
|
ALTER TABLE ONLY packet_component
|
||||||
ADD CONSTRAINT pk_packet_component PRIMARY KEY (packet_component_id);
|
ADD CONSTRAINT pk_packet_component PRIMARY KEY (basepacket_id, basecomponent_id, packet_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -643,6 +616,13 @@ ALTER TABLE ONLY unixuser
|
|||||||
ADD CONSTRAINT unixuser_name_key UNIQUE (name);
|
ADD CONSTRAINT unixuser_name_key UNIQUE (name);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: bank_account_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX bank_account_in_1 ON bank_account USING btree (bp_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: basecomponent_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: basecomponent_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -657,6 +637,13 @@ CREATE UNIQUE INDEX basecomponent_in_1 ON basecomponent USING btree (basecompone
|
|||||||
CREATE UNIQUE INDEX basepacket_in_1 ON basepacket USING btree (basepacket_code);
|
CREATE UNIQUE INDEX basepacket_in_1 ON basepacket USING btree (basepacket_code);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: billdata_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX billdata_in_1 ON billdata USING btree (bp_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: component_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: component_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -810,6 +797,14 @@ ALTER TABLE ONLY emailalias
|
|||||||
ADD CONSTRAINT emailalias_pac_id_fkey FOREIGN KEY (pac_id) REFERENCES packet(packet_id) DEFERRABLE;
|
ADD CONSTRAINT emailalias_pac_id_fkey FOREIGN KEY (pac_id) REFERENCES packet(packet_id) DEFERRABLE;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: fk_bank_acc_reference_business; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY bank_account
|
||||||
|
ADD CONSTRAINT fk_bank_acc_reference_business FOREIGN KEY (bp_id) REFERENCES business_partner(bp_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: fk_bcomp_bpack; Type: FK CONSTRAINT; Schema: public; Owner: -
|
-- Name: fk_bcomp_bpack; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -818,6 +813,22 @@ ALTER TABLE ONLY component
|
|||||||
ADD CONSTRAINT fk_bcomp_bpack FOREIGN KEY (basepacket_id) REFERENCES basepacket(basepacket_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
ADD CONSTRAINT fk_bcomp_bpack FOREIGN KEY (basepacket_id) REFERENCES basepacket(basepacket_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: fk_billdata_reference_business; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY billdata
|
||||||
|
ADD CONSTRAINT fk_billdata_reference_business FOREIGN KEY (bp_id) REFERENCES business_partner(bp_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: fk_comp_bcomp; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY packet_component
|
||||||
|
ADD CONSTRAINT fk_comp_bcomp FOREIGN KEY (basepacket_id, basecomponent_id) REFERENCES component(basepacket_id, basecomponent_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: fk_comp_pack; Type: FK CONSTRAINT; Schema: public; Owner: -
|
-- Name: fk_comp_pack; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
BIN
hsarback/lib/commons-beanutils-1.8.3.jar
Normal file
BIN
hsarback/lib/commons-beanutils-1.8.3.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
hsarback/lib/commons-collections-3.2.1.jar
Normal file
BIN
hsarback/lib/commons-collections-3.2.1.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
hsarback/lib/commons-lang-2.4.jar
Normal file
BIN
hsarback/lib/commons-lang-2.4.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
hsarback/lib/commons-pool-1.5.4.jar
Normal file
BIN
hsarback/lib/commons-pool-1.5.4.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
hsarback/lib/jpwgen-1.2.0.jar
Normal file
BIN
hsarback/lib/jpwgen-1.2.0.jar
Normal file
Binary file not shown.
BIN
hsarback/lib/openjpa-2.1.1.jar
Normal file
BIN
hsarback/lib/openjpa-2.1.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
hsarback/lib/serp-1.13.1.jar
Normal file
BIN
hsarback/lib/serp-1.13.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
125
hsarback/pom.xml
125
hsarback/pom.xml
@ -1,125 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>de.hsadmin</groupId>
|
|
||||||
<artifactId>hsar</artifactId>
|
|
||||||
<packaging>war</packaging>
|
|
||||||
<version>4.0.16</version>
|
|
||||||
<name>HSAdmin Stable Backend Webapp</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>local</id>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/local-resources</directory>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.hsadmin.core</groupId>
|
|
||||||
<artifactId>hsadmin-util</artifactId>
|
|
||||||
<version>4.0.16</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.hsadmin.core</groupId>
|
|
||||||
<artifactId>hsadmin-qserv</artifactId>
|
|
||||||
<version>4.0.16</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-httpclient</groupId>
|
|
||||||
<artifactId>commons-httpclient</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-lang</groupId>
|
|
||||||
<artifactId>commons-lang</artifactId>
|
|
||||||
<version>2.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-net</groupId>
|
|
||||||
<artifactId>commons-net</artifactId>
|
|
||||||
<version>3.9.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
|
||||||
<artifactId>xmlrpc-server</artifactId>
|
|
||||||
<version>3.1.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
|
||||||
<artifactId>xmlrpc-client</artifactId>
|
|
||||||
<version>3.1.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.velocity</groupId>
|
|
||||||
<artifactId>velocity</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.openjpa</groupId>
|
|
||||||
<artifactId>openjpa</artifactId>
|
|
||||||
<version>2.4.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.13.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<version>4.0.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.activemq</groupId>
|
|
||||||
<artifactId>activemq-all</artifactId>
|
|
||||||
<version>5.5.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.geronimo.specs</groupId>
|
|
||||||
<artifactId>geronimo-jms_1.1_spec</artifactId>
|
|
||||||
<version>1.1.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<finalName>hsar</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<version>3.4.0</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.11.0</version>
|
|
||||||
<configuration>
|
|
||||||
<source>8</source>
|
|
||||||
<target>8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
357
hsarback/src/de/hsadmin/cliClientConnector/ArgumentParser.java
Normal file
357
hsarback/src/de/hsadmin/cliClientConnector/ArgumentParser.java
Normal file
@ -0,0 +1,357 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import de.hsadmin.cliClientConnector.CLIClientConnectorServlet.FunctionNotKnownException;
|
||||||
|
import de.hsadmin.cliClientConnector.CLIClientConnectorServlet.UnknownModuleException;
|
||||||
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
|
import de.hsadmin.core.model.ModuleInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses Arguments for the CLI Client Connector Servlet
|
||||||
|
*
|
||||||
|
* @author Christof Donat
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ArgumentParser {
|
||||||
|
/// I am working for this Servlet instance
|
||||||
|
private CLIClientConnectorServlet master;
|
||||||
|
private DateFormat df = new SimpleDateFormat( "yyyy-MM-dd");
|
||||||
|
|
||||||
|
public ArgumentParser(CLIClientConnectorServlet master) {
|
||||||
|
this.master = master;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUsageString() {
|
||||||
|
return " [ (-W name=value|--globalWhere:name=value) ...]\n"+
|
||||||
|
" [ (-S name=value|--globalSet:name=value) ...]\n"+
|
||||||
|
" [ (-D displayspec|--globalDisplay=displayspec) ...]\n"+
|
||||||
|
" [ (-c module.function|--call=module.function)\n" +
|
||||||
|
" [ (-w name=value|--where:name=value) ...]\n"+
|
||||||
|
" [ (-s name=value|--set:name=value) ...]\n"+
|
||||||
|
" [ (-d displayspec|--display:displayspec) ...]\n"+
|
||||||
|
" [ oids ...] ] ]\n"+
|
||||||
|
"\n"+
|
||||||
|
"(" + CLIClientConnectorServlet.version + ")\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<Method> getMethodList(Object o) {
|
||||||
|
Method[] meths = o.getClass().getMethods();
|
||||||
|
ArrayList<Method> methodlist = new ArrayList<Method>();
|
||||||
|
|
||||||
|
for( int i = 0; i < meths.length; i++ ) {
|
||||||
|
Method m = meths[i];
|
||||||
|
String n = m.getName();
|
||||||
|
if( n.startsWith("get") && !n.equals("getNew") ) {
|
||||||
|
String fn = m.getName().substring(3).toLowerCase();
|
||||||
|
if( fn.equals("class") ) continue;
|
||||||
|
if (m.getParameterTypes().length == 0) {
|
||||||
|
methodlist.add(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return methodlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Hashtable<String,String> getValues(Object o, ArrayList<Method> methodlist, ArrayList<String>fieldNames, boolean deep, ArrayList<Object> foundObjects) {
|
||||||
|
Hashtable<String,String> row = new Hashtable<String,String>();
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
if( foundObjects == null ) foundObjects = new ArrayList<Object>();
|
||||||
|
|
||||||
|
for( i = 0; i < methodlist.size(); i++ ) {
|
||||||
|
Method m = methodlist.get(i);
|
||||||
|
try {
|
||||||
|
String name = fieldNames.get(i);
|
||||||
|
String type = m.getReturnType().getCanonicalName();
|
||||||
|
String val = "";
|
||||||
|
|
||||||
|
Object value = null;
|
||||||
|
try {
|
||||||
|
value = m.invoke(o);
|
||||||
|
} catch( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( value == null )
|
||||||
|
val = "";
|
||||||
|
else if( type.equals("java.lang.String") )
|
||||||
|
val = (String)value;
|
||||||
|
else if( type.equals("java.lang.Integer") )
|
||||||
|
val = String.valueOf((Integer)value);
|
||||||
|
else if( type.equals("java.lang.Long") )
|
||||||
|
val = String.valueOf((Long)value);
|
||||||
|
else if( type.equals("java.lang.Boolean") )
|
||||||
|
val = String.valueOf((Boolean)value);
|
||||||
|
else if( type.equals("java.util.Date") ) {
|
||||||
|
val = df.format((Date)value);
|
||||||
|
} else if( type.equals("java.util.Set") ) {
|
||||||
|
val = "<Set>";
|
||||||
|
} else try {
|
||||||
|
AbstractEntity v = (AbstractEntity)value;
|
||||||
|
val = v.createStringKey();
|
||||||
|
if( deep && !foundObjects.contains(v) ) {
|
||||||
|
foundObjects.add(v);
|
||||||
|
ArrayList<String> fieldNamesDeep = new ArrayList<String>();
|
||||||
|
ArrayList<Method> methodlistDeep = getMethodList(v);
|
||||||
|
for( j = 0; j < methodlistDeep.size(); j++ ) {
|
||||||
|
fieldNamesDeep.add(methodlistDeep.get(j).getName().substring(3).toLowerCase());
|
||||||
|
}
|
||||||
|
Hashtable<String,String> tmp = getValues(v,methodlistDeep,fieldNamesDeep,deep,foundObjects);
|
||||||
|
Enumeration<String> keys = tmp.keys();
|
||||||
|
while(keys.hasMoreElements()) {
|
||||||
|
try {
|
||||||
|
String k = (String)keys.nextElement();
|
||||||
|
row.put(name+"."+k, tmp.get(k));
|
||||||
|
} catch( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(ClassCastException e) {
|
||||||
|
val = value.toString();
|
||||||
|
}
|
||||||
|
if (val != null) row.put(name, val);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatObjectsWithoutDisplay(int j, ArrayList<String> fieldNames, ArrayList<Integer>columnWidths, ArrayList<Hashtable<String,String> > rows) {
|
||||||
|
int i;
|
||||||
|
StringBuffer rval = new StringBuffer();
|
||||||
|
|
||||||
|
for( i = 0; i < fieldNames.size(); i++ ) {
|
||||||
|
StringBuffer name = new StringBuffer(fieldNames.get(i));
|
||||||
|
int fieldwidth = columnWidths.get(i);
|
||||||
|
while( name.length() < fieldwidth )
|
||||||
|
name.append(" ");
|
||||||
|
rval.append(name.toString()+((i < fieldNames.size()-1)?" | ":""));
|
||||||
|
}
|
||||||
|
rval.append("\n");
|
||||||
|
for( i = 0; i < j; i++ )
|
||||||
|
rval.append("-");
|
||||||
|
rval.append("\n");
|
||||||
|
|
||||||
|
for( j = 0; j < rows.size(); j++ ) {
|
||||||
|
for( i = 0; i < fieldNames.size(); i++ ) {
|
||||||
|
StringBuffer value = new StringBuffer(rows.get(j).get(fieldNames.get(i)));
|
||||||
|
int fieldwidth = columnWidths.get(i);
|
||||||
|
while( value.length() < fieldwidth )
|
||||||
|
value.append(" ");
|
||||||
|
rval.append(value.toString()+((i < fieldNames.size()-1)?" | ":""));
|
||||||
|
}
|
||||||
|
rval.append("\n");
|
||||||
|
}
|
||||||
|
return rval.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatObjectsWithDisplay(ArrayList<Hashtable<String,String> > rows, String displayDef) {
|
||||||
|
StringBuffer rval = new StringBuffer();
|
||||||
|
for( int j = 0; j < rows.size(); j++) {
|
||||||
|
String rv = displayDef;
|
||||||
|
Enumeration<String> fNames = rows.get(j).keys();
|
||||||
|
while( fNames.hasMoreElements() ) {
|
||||||
|
String f = (String)fNames.nextElement();
|
||||||
|
rv = rv.replaceAll("\\$\\{"+f+"\\}", rows.get(j).get(f));
|
||||||
|
}
|
||||||
|
rv = rv.replaceAll("\\\\n", "\n");
|
||||||
|
rv = rv.replaceAll("\\\\t", "\t");
|
||||||
|
rv = rv.replaceAll("\\\\(.)?", "$1");
|
||||||
|
rval.append(rv);
|
||||||
|
}
|
||||||
|
return rval.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* format Objects for the output as a Human readable table
|
||||||
|
*
|
||||||
|
* @param objects
|
||||||
|
* format these objects
|
||||||
|
*
|
||||||
|
* @return humanReadableString
|
||||||
|
* a string with the human readable representation of the objects
|
||||||
|
*/
|
||||||
|
public String formatObjects(List<?> objects, String displayDef) {
|
||||||
|
if( objects.size() == 0 ) return "";
|
||||||
|
if( objects.get(0) == null ) return "";
|
||||||
|
ArrayList<Method> methodlist = getMethodList(objects.get(0));
|
||||||
|
ArrayList<Integer>columnWidths = new ArrayList<Integer>();
|
||||||
|
ArrayList<String>fieldNames = new ArrayList<String>();
|
||||||
|
ArrayList<Hashtable<String,String> > rows =
|
||||||
|
new ArrayList<Hashtable<String,String> >();
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for( i = 0; i < methodlist.size(); i++ ) {
|
||||||
|
Method m = methodlist.get(i);
|
||||||
|
String n = m.getName();
|
||||||
|
String fn = n.substring(3).toLowerCase();
|
||||||
|
fieldNames.add(fn);
|
||||||
|
columnWidths.add(n.length()+3);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( j = 0; j < objects.size(); j++ ) {
|
||||||
|
Object o = objects.get(j);
|
||||||
|
Hashtable<String,String> row = getValues(o,methodlist,fieldNames,(displayDef != null), null);
|
||||||
|
for( i = 0; i < fieldNames.size(); i++ ) {
|
||||||
|
String val = row.get(fieldNames.get(i));
|
||||||
|
if( val != null && i < columnWidths.size() && val.length()+3 > columnWidths.get(i) )
|
||||||
|
columnWidths.set(i, val.length()+3);
|
||||||
|
}
|
||||||
|
rows.add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( displayDef == null ) {
|
||||||
|
j = 0;
|
||||||
|
for( i = 0; i < columnWidths.size(); i++ ) {
|
||||||
|
j += columnWidths.get(i)+2;
|
||||||
|
}
|
||||||
|
j -= 2;
|
||||||
|
|
||||||
|
return formatObjectsWithoutDisplay(j, fieldNames, columnWidths, rows);
|
||||||
|
} else
|
||||||
|
return formatObjectsWithDisplay(rows, displayDef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main parser function. Parses the Parameters, uses the master to call
|
||||||
|
* the functions and returns a formatet output.
|
||||||
|
*
|
||||||
|
* @param arguments
|
||||||
|
* @return humanReadableObjectsString
|
||||||
|
*/
|
||||||
|
public String parse(List<String> arguments, ModuleInterface module) {
|
||||||
|
String rval = "";
|
||||||
|
|
||||||
|
String currentModule = null;
|
||||||
|
String currentFunction = null;
|
||||||
|
Map<String,String> currentWhere = new Hashtable<String,String>();
|
||||||
|
Map<String,String> currentSet = new Hashtable<String,String>();
|
||||||
|
ArrayList<String> currentOIDs = new ArrayList<String>();
|
||||||
|
|
||||||
|
Map<String,String> globalWhere = new Hashtable<String,String>();
|
||||||
|
Map<String,String> globalSet = new Hashtable<String,String>();
|
||||||
|
String display = null;
|
||||||
|
String globalDisplay = null;
|
||||||
|
|
||||||
|
for( int i = 0; i < arguments.size(); i++ ) {
|
||||||
|
String arg = arguments.get(i);
|
||||||
|
|
||||||
|
if( arg.equals("-c") || arg.startsWith("--call:") ) {
|
||||||
|
// call
|
||||||
|
if( currentModule != null ) {
|
||||||
|
try {
|
||||||
|
// execute the last call now
|
||||||
|
rval += formatObjects(master.callModule(
|
||||||
|
currentModule,
|
||||||
|
currentFunction,
|
||||||
|
currentWhere,
|
||||||
|
currentSet,
|
||||||
|
currentOIDs,
|
||||||
|
module),(display==null)?globalDisplay:display);
|
||||||
|
} catch (FunctionNotKnownException e) {
|
||||||
|
rval += "Function unknown: "+currentModule+'.'+currentFunction+"\n";
|
||||||
|
} catch (UnknownModuleException e) {
|
||||||
|
rval += "Module unknown: "+currentModule+"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reset parameters for next call
|
||||||
|
currentWhere = new HashMap<String, String>();
|
||||||
|
currentWhere.putAll(globalWhere);
|
||||||
|
currentSet = new HashMap<String, String>();
|
||||||
|
currentSet.putAll(globalSet);
|
||||||
|
currentOIDs = new ArrayList<String>();
|
||||||
|
display = null;
|
||||||
|
|
||||||
|
// set the new call
|
||||||
|
boolean isShortParam = arg.equals("-c");
|
||||||
|
String calldef = isShortParam?arguments.get(i+1):arg.substring(7);
|
||||||
|
|
||||||
|
if( calldef != null ) {
|
||||||
|
String[] split = calldef.split("[.]", 2);
|
||||||
|
currentModule = split[0];
|
||||||
|
currentFunction = split[1];
|
||||||
|
}
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-w") || arg.startsWith("--where:") ) {
|
||||||
|
// where
|
||||||
|
boolean isShortParam = arg.equals("-w");
|
||||||
|
String wheredef = isShortParam?arguments.get(i+1):arg.substring(8);
|
||||||
|
if( wheredef != null ) {
|
||||||
|
String[] split = wheredef.split("[=]", 2);
|
||||||
|
currentWhere.put(split[0],split[1]);
|
||||||
|
}
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-W") || arg.startsWith("--globalWhere:") ) {
|
||||||
|
// global where
|
||||||
|
boolean isShortParam = arg.equals("-W");
|
||||||
|
String gwheredef = isShortParam?arguments.get(i+1):arg.substring(14);
|
||||||
|
if( gwheredef != null ) {
|
||||||
|
String[] split = gwheredef.split("[=]", 2);
|
||||||
|
globalWhere.put(split[0],split[1]);
|
||||||
|
}
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-s") || arg.startsWith("--set:") ) {
|
||||||
|
// set
|
||||||
|
boolean isShortParam = arg.equals("-s");
|
||||||
|
String setdef = isShortParam?arguments.get(i+1):arg.substring(6);
|
||||||
|
if( setdef != null ) {
|
||||||
|
String[] split = setdef.split("[=]", 2);
|
||||||
|
currentSet.put(split[0],split[1]);
|
||||||
|
}
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-S") || arg.startsWith("--globalSet:") ) {
|
||||||
|
// global set
|
||||||
|
boolean isShortParam = arg.equals("-S");
|
||||||
|
String gsetdef = isShortParam?arguments.get(i+1):arg.substring(12);
|
||||||
|
if( gsetdef != null ) {
|
||||||
|
String[] split = gsetdef.split("[=]", 2);
|
||||||
|
globalSet.put(split[0],split[1]);
|
||||||
|
}
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-d") || arg.startsWith("--display:") ) {
|
||||||
|
// display
|
||||||
|
boolean isShortParam = arg.equals("-d");
|
||||||
|
display = isShortParam?arguments.get(i+1):arg.substring(10);
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-D") || arg.startsWith("--globalDisplay:") ) {
|
||||||
|
// global display
|
||||||
|
boolean isShortParam = arg.equals("-D");
|
||||||
|
globalDisplay = isShortParam?arguments.get(i+1):arg.substring(16);
|
||||||
|
if( isShortParam ) i++;
|
||||||
|
} else if( arg.equals("-h") || arg.equals("--help") ) {
|
||||||
|
return getUsageString();
|
||||||
|
} else if( arg.startsWith("-") ) {
|
||||||
|
return "unknown option '"+arg+"'\n"+getUsageString();
|
||||||
|
} else currentOIDs.add(arg);
|
||||||
|
}
|
||||||
|
if( currentModule != null ) {
|
||||||
|
try {
|
||||||
|
rval += formatObjects(master.callModule(
|
||||||
|
currentModule,
|
||||||
|
currentFunction,
|
||||||
|
currentWhere,
|
||||||
|
currentSet,
|
||||||
|
currentOIDs,
|
||||||
|
module),(display==null)?globalDisplay:display);
|
||||||
|
} catch (FunctionNotKnownException e) {
|
||||||
|
rval += "Function unknown: "+currentModule+'.'+currentFunction+"\n";
|
||||||
|
} catch (UnknownModuleException e) {
|
||||||
|
rval += "Module unknown: "+currentModule+"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class BusinessException
|
||||||
|
extends RuntimeException
|
||||||
|
{
|
||||||
|
|
||||||
|
public BusinessException(String msg)
|
||||||
|
{
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessException(Exception exc)
|
||||||
|
{
|
||||||
|
super(exc.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,497 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
|
import de.hsadmin.core.model.GenericModuleImpl;
|
||||||
|
import de.hsadmin.core.model.ModuleInterface;
|
||||||
|
import de.hsadmin.core.model.TicketValidator;
|
||||||
|
import de.hsadmin.core.model.Transaction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* actually this is the core of the CLI-Client. The other CLI-Client is just a
|
||||||
|
* rather simple HTTP Client that calls this Servlet.
|
||||||
|
*
|
||||||
|
* @author Christof Donat
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CLIClientConnectorServlet extends HttpServlet {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7150004719303750077L;
|
||||||
|
public static final String version = "CLI Servlet 2.0.0 (2011/May/21 09:00 MEST)";
|
||||||
|
|
||||||
|
private Map<String, Class<?>> componentmap;
|
||||||
|
private Map<String, String> componentDescriptions;
|
||||||
|
private ArgumentParser parser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Servlet initialization
|
||||||
|
*/
|
||||||
|
public void init(ServletConfig cfg) {
|
||||||
|
// init ticket validator
|
||||||
|
String validateURL = cfg.getInitParameter("proxyValidateUrl");
|
||||||
|
String serviceURL = cfg.getInitParameter("proxyServiceUrl");
|
||||||
|
TicketValidator.getInstance().initialize(validateURL, serviceURL);
|
||||||
|
// find components
|
||||||
|
String cstring = cfg.getInitParameter("Components");
|
||||||
|
String[] components = cstring.split(",");
|
||||||
|
|
||||||
|
componentmap = new HashMap<String, Class<?>>();
|
||||||
|
componentDescriptions = new HashMap<String, String>();
|
||||||
|
for (int i = 0; i < components.length; i++) {
|
||||||
|
// get everything for this component and create an entry.
|
||||||
|
try {
|
||||||
|
// component class
|
||||||
|
String classname = cfg.getInitParameter("ComponentClass_"
|
||||||
|
+ components[i]);
|
||||||
|
if (classname == null)
|
||||||
|
throw new NullPointerException(
|
||||||
|
"no class name found for Component "
|
||||||
|
+ components[i]);
|
||||||
|
Class<?> cls = Class.forName(classname);
|
||||||
|
componentmap.put(components[i], cls);
|
||||||
|
// description
|
||||||
|
String descr = cfg.getInitParameter("ComponentDescription_"
|
||||||
|
+ components[i]);
|
||||||
|
if (descr != null)
|
||||||
|
componentDescriptions.put(components[i], descr);
|
||||||
|
else
|
||||||
|
componentDescriptions.put(components[i], "");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: get username, password from http session
|
||||||
|
parser = new ArgumentParser(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set values to a given entity Object
|
||||||
|
*
|
||||||
|
* @param o
|
||||||
|
* the entity Object
|
||||||
|
* @param set
|
||||||
|
* Hashtable with names and values that sould be changed in o
|
||||||
|
*/
|
||||||
|
private void setValues(Object o, Map<String, String> set, ModuleInterface module) {
|
||||||
|
Iterator<String> keys = set.keySet().iterator();
|
||||||
|
while (keys.hasNext()) {
|
||||||
|
String key = keys.next();
|
||||||
|
String[] ns = key.split("[.]", 2);
|
||||||
|
Object realO = o;
|
||||||
|
for (int i = 0; i < ns.length - 1; i++) {
|
||||||
|
Method[] m = realO.getClass().getMethods();
|
||||||
|
boolean oFound = false;
|
||||||
|
for (int j = 0; j < m.length; j++) {
|
||||||
|
if (m[j].getName().toLowerCase().equals(
|
||||||
|
"get" + ns[i].toLowerCase())) {
|
||||||
|
try {
|
||||||
|
realO = m[j].invoke(realO, (Object[]) null);
|
||||||
|
oFound = (realO != null);
|
||||||
|
break;
|
||||||
|
} catch (Exception e) {
|
||||||
|
new TechnicalException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!oFound)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Method[] m = realO.getClass().getMethods();
|
||||||
|
String value = set.get(key);
|
||||||
|
for (int j = 0; j < m.length; j++) {
|
||||||
|
if (!m[j].getName().toLowerCase().equals(
|
||||||
|
"set" + ns[ns.length - 1].toLowerCase()))
|
||||||
|
continue;
|
||||||
|
String type = m[j].getParameterTypes()[0].getCanonicalName();
|
||||||
|
try {
|
||||||
|
if (type.equals("java.lang.String"))
|
||||||
|
m[j].invoke(realO, value);
|
||||||
|
else if (type.equals("java.lang.Integer") || type.equals("int"))
|
||||||
|
m[j].invoke(realO, Integer.parseInt(value));
|
||||||
|
else if (type.equals("java.lang.Long") || type.equals("long"))
|
||||||
|
m[j].invoke(realO, Long.parseLong(value));
|
||||||
|
else if (type.equals("java.lang.Boolean") || type.equals("boolean"))
|
||||||
|
m[j].invoke(realO, Boolean.valueOf(value));
|
||||||
|
else if (type.equals("java.util.Date")) {
|
||||||
|
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMANY);
|
||||||
|
m[j].invoke(realO, df.parse(value));
|
||||||
|
} else {
|
||||||
|
Method m2 = module.getClass().getMethod(
|
||||||
|
"findByString", Class.class, String.class);
|
||||||
|
Object entity =
|
||||||
|
m2.invoke(module, m[j].getParameterTypes()[0], value);
|
||||||
|
if (entity != null)
|
||||||
|
m[j].invoke(realO, entity);
|
||||||
|
else
|
||||||
|
throw new BusinessException(
|
||||||
|
"not object found for '" + value + "'");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new TechnicalException(e); // TODO: this needs to be
|
||||||
|
// more specific for
|
||||||
|
// some cases
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String hasGetter(Class<?> eType, String name) {
|
||||||
|
String rval = null;
|
||||||
|
String[] ns = name.split("[.]", 2);
|
||||||
|
String n1 = ns[0];
|
||||||
|
Method meth = null;
|
||||||
|
|
||||||
|
for (Method m : eType.getMethods()) {
|
||||||
|
String n = m.getName();
|
||||||
|
if (n.startsWith("get")) {
|
||||||
|
String fn = m.getName().substring(3).toLowerCase();
|
||||||
|
if (fn != "class" && fn.equals(n1)) {
|
||||||
|
meth = m;
|
||||||
|
rval = fn;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (meth != null) {
|
||||||
|
Class<?> returnType = meth.getReturnType();
|
||||||
|
if (rval != null && ns.length > 1 && meth != null)
|
||||||
|
return hasGetter(returnType, ns[1]);
|
||||||
|
if (returnType.getCanonicalName().startsWith("de.hsadmin.mods")) {
|
||||||
|
try {
|
||||||
|
if (returnType.getMethod("getName") != null) {
|
||||||
|
return rval + ".name";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// no method found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* builds a query from a where clause and some objectIDs.
|
||||||
|
*
|
||||||
|
* @param eType
|
||||||
|
* The class of the Entity Object for which the string should be
|
||||||
|
* built. We need this to call the static method
|
||||||
|
* "createQueryFromStringKey"
|
||||||
|
* @param where
|
||||||
|
* Hashtable with where parameters. Only objects which match all
|
||||||
|
* where parameters are found
|
||||||
|
* @param oids
|
||||||
|
* Only objects with one of these object IDs are found
|
||||||
|
*
|
||||||
|
* @return queryString a query string that can be used to select the
|
||||||
|
* required Objects
|
||||||
|
* @throws ServletException
|
||||||
|
*/
|
||||||
|
private String buildQuery(Class<?> eType, Map<String, String> where,
|
||||||
|
ArrayList<String> oids) throws ServletException {
|
||||||
|
String rval = "";
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
|
Iterator<String> wkeys = where.keySet().iterator();
|
||||||
|
while (wkeys.hasNext()) {
|
||||||
|
String k = (String) wkeys.next();
|
||||||
|
String kname = hasGetter(eType, k);
|
||||||
|
String kvalue = ( (k.equals("id"))
|
||||||
|
? ( AbstractEntity.escapeString(where.get(k)) )
|
||||||
|
: ( "'" + AbstractEntity.escapeString(where.get(k)) + "'" ) );
|
||||||
|
if (kname != null) {
|
||||||
|
rval += (first ? "" : " and ")
|
||||||
|
+ "(obj." + AbstractEntity.escapeString(kname) + " = " + kvalue + ")";
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
|
throw new ServletException("illegal input (unknown field: " + k + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String rv = "";
|
||||||
|
if (oids != null)
|
||||||
|
try {
|
||||||
|
Method m;
|
||||||
|
m = eType.getMethod("createQueryFromStringKey", String.class);
|
||||||
|
|
||||||
|
first = true;
|
||||||
|
for (String s : oids) {
|
||||||
|
rv += (first ? "" : " or ") + "("
|
||||||
|
+ (String) m.invoke(eType, s) + ")";
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
if (rv != "" && rval != "")
|
||||||
|
rval = rval + " and (" + rv + ")";
|
||||||
|
else if (rv != "")
|
||||||
|
rval = rv;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new TechnicalException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (rval == "") ? null : rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FunctionNotKnownException extends Exception {
|
||||||
|
private static final long serialVersionUID = -6330015688609717838L;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UnknownModuleException extends Exception {
|
||||||
|
private static final long serialVersionUID = 696641072107896601L;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object callAdd(Class<?> cls, Map<String, String> set, ModuleInterface module) {
|
||||||
|
Transaction transaction = module.getTransaction();
|
||||||
|
transaction.beginTransaction();
|
||||||
|
try {
|
||||||
|
Method m = module.getClass().getMethod("add", AbstractEntity.class);
|
||||||
|
Object o = cls.newInstance();
|
||||||
|
setValues(o, set, module);
|
||||||
|
m.invoke(module, o);
|
||||||
|
transaction.commitTransaction();
|
||||||
|
return null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
transaction.rollbackTransaction();
|
||||||
|
// TODO: this needs to be more specific, but how?
|
||||||
|
throw new TechnicalException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<Object> callSearch(Class<?> cls, Map<String, String> where,
|
||||||
|
ArrayList<String> oids, ModuleInterface module) {
|
||||||
|
try {
|
||||||
|
Method m = module.getClass().getMethod("search", Class.class,
|
||||||
|
String.class, String.class);
|
||||||
|
return (List<Object>) m.invoke(module, cls,
|
||||||
|
buildQuery(cls, where, oids), null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new TechnicalException(e); // TODO: this needs to be more
|
||||||
|
// specific, but how?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// / checks wheather all 'oids' are in 'list'
|
||||||
|
private void checkOids(List<AbstractEntity> list, List<String> oids) {
|
||||||
|
List<String> oidsNotFound = new ArrayList<String>();
|
||||||
|
for (String id : oids) {
|
||||||
|
boolean found = false;
|
||||||
|
for (AbstractEntity e : list) {
|
||||||
|
String foundKey = e.createStringKey();
|
||||||
|
if (foundKey.equals(id)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
oidsNotFound.add(id);
|
||||||
|
}
|
||||||
|
if (oidsNotFound.size() > 0) {
|
||||||
|
throw new OidsNotFoundException(oids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<Object> callUpdate(Class<?> cls, Map<String, String> where,
|
||||||
|
ArrayList<String> oids, Map<String, String> set,
|
||||||
|
ModuleInterface module) {
|
||||||
|
// better safe than sorry - alsd hso same behavior as UNIX rm
|
||||||
|
if (where.size() == 0 && oids.size() == 0)
|
||||||
|
throw new BusinessException(
|
||||||
|
"better safe than sorry - 'update' needs a -w/--where-query or object id");
|
||||||
|
Transaction tx = module.getTransaction();
|
||||||
|
tx.beginTransaction();
|
||||||
|
try {
|
||||||
|
Method m = module.getClass().getMethod("search", Class.class,
|
||||||
|
String.class, String.class);
|
||||||
|
List<AbstractEntity> list = (List<AbstractEntity>) m.invoke(module, cls,
|
||||||
|
buildQuery(cls, where, oids), null);
|
||||||
|
checkOids(list, oids);
|
||||||
|
Method m2 = module.getClass().getMethod("update", AbstractEntity.class);
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
AbstractEntity entity = list.get(i);
|
||||||
|
tx.detach(entity);
|
||||||
|
setValues(entity, set, module);
|
||||||
|
m2.invoke(module, entity);
|
||||||
|
}
|
||||||
|
tx.commitTransaction();
|
||||||
|
} catch (Exception e) {
|
||||||
|
tx.rollbackTransaction();
|
||||||
|
// TODO: this needs to be more specific, but how?
|
||||||
|
throw new TechnicalException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void callDelete(Class<?> cls, Map<String, String> where,
|
||||||
|
ArrayList<String> oids, ModuleInterface module) {
|
||||||
|
// better safe than sorry - also same behavior as UNIX rm
|
||||||
|
if (where.size() == 0 && oids.size() == 0)
|
||||||
|
throw new BusinessException(
|
||||||
|
"better safe than sorry - 'update' needs a -w/--where-query or object id");
|
||||||
|
Transaction tx = module.getTransaction();
|
||||||
|
tx.beginTransaction();
|
||||||
|
try {
|
||||||
|
Method m =
|
||||||
|
module.getClass().getMethod("search", Class.class, String.class, String.class);
|
||||||
|
List<AbstractEntity> list =
|
||||||
|
(List<AbstractEntity>) m.invoke(module, cls, buildQuery(cls, where, oids), null);
|
||||||
|
checkOids(list, oids);
|
||||||
|
Method m2 = module.getClass().getMethod("delete", AbstractEntity.class);
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
Object o = list.get(i);
|
||||||
|
m2.invoke(module, o);
|
||||||
|
}
|
||||||
|
tx.commitTransaction();
|
||||||
|
} catch (Exception e) {
|
||||||
|
tx.rollbackTransaction();
|
||||||
|
// TODO: this needs to be more specific, but how?
|
||||||
|
throw new TechnicalException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call one of the EntitySessions methods
|
||||||
|
*
|
||||||
|
* @param moduleName
|
||||||
|
* Defines the Entity class that will be given to the
|
||||||
|
* EntitySession
|
||||||
|
* @param function
|
||||||
|
* Defines the method that will be called. The function can be
|
||||||
|
* "add", "search", "update" and "delete".
|
||||||
|
* @param where
|
||||||
|
* Reduces the set of Entity objects which the function operates
|
||||||
|
* on to those matched by the where parameters. Only for
|
||||||
|
* "search", "update" and "delete". Will be ignored otherwise.
|
||||||
|
* @param set
|
||||||
|
* Set these values on all Objects - only for "add" and "update".
|
||||||
|
* Will be ignored otherwise.
|
||||||
|
* @param oids
|
||||||
|
* Works on Objects with these IDs. Only for "search", "update"
|
||||||
|
* and "delete". Will be ignored for "add".
|
||||||
|
* @return foundObjects
|
||||||
|
* @throws FunctionNotKnownException
|
||||||
|
*/
|
||||||
|
public List<Object> callModule(String moduleName, String function,
|
||||||
|
Map<String, String> where, Map<String, String> set,
|
||||||
|
ArrayList<String> oids, ModuleInterface module)
|
||||||
|
throws FunctionNotKnownException, UnknownModuleException {
|
||||||
|
List<Object> rval = new ArrayList<Object>();
|
||||||
|
|
||||||
|
// handle calls to the virtual module "modules"
|
||||||
|
if (moduleName.equals("modules")) {
|
||||||
|
// only search, no manipulation is possible
|
||||||
|
if (function.equals("search")) {
|
||||||
|
Iterator<?> m = componentDescriptions.keySet().iterator();
|
||||||
|
while (m.hasNext()) {
|
||||||
|
String mn = (String) m.next();
|
||||||
|
rval.add(new ModuleModel(mn, componentDescriptions.get(mn)));
|
||||||
|
}
|
||||||
|
} else if (function.equals("version")) {
|
||||||
|
rval.add(new VersionModel(version));
|
||||||
|
} else {
|
||||||
|
throw new FunctionNotKnownException();
|
||||||
|
}
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find the component for the named module
|
||||||
|
Class<?> cls = componentmap.get(moduleName);
|
||||||
|
if (cls == null)
|
||||||
|
throw (new UnknownModuleException());
|
||||||
|
|
||||||
|
// call the appropriate methods
|
||||||
|
if (function.equals("add"))
|
||||||
|
rval.add(callAdd(cls, set, module));
|
||||||
|
else if (function.equals("search")) {
|
||||||
|
List<Object> r = callSearch(cls, where, oids, module);
|
||||||
|
if (r != null)
|
||||||
|
return r;
|
||||||
|
} else if (function.equals("update")) {
|
||||||
|
List<Object> r = callUpdate(cls, where, oids, set, module);
|
||||||
|
if (r != null)
|
||||||
|
return callUpdate(cls, where, oids, set, module);
|
||||||
|
} else if (function.equals("delete")) {
|
||||||
|
callDelete(cls, where, oids, module);
|
||||||
|
} else
|
||||||
|
throw (new FunctionNotKnownException());
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* handle put method
|
||||||
|
*/
|
||||||
|
public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException {
|
||||||
|
try {
|
||||||
|
ModuleInterface module = null;
|
||||||
|
Transaction tx = null;
|
||||||
|
// check login
|
||||||
|
String auth = req.getHeader("authorization");
|
||||||
|
if (auth == null) {
|
||||||
|
// no login information at all - get it
|
||||||
|
resp.setHeader("WWW-Authenticate",
|
||||||
|
"Basic realm=\"CLIClientConnector\"");
|
||||||
|
resp.getOutputStream().println("login Failed.");
|
||||||
|
resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// parse login information
|
||||||
|
String[] a = auth.split(" ", 2);
|
||||||
|
String ticket = a[1];
|
||||||
|
byte[] decoded = Base64.decodeBase64(ticket.trim().getBytes());
|
||||||
|
String s = new String(decoded);
|
||||||
|
a = s.split(":", 2);
|
||||||
|
// try to log in
|
||||||
|
String login = a[0];
|
||||||
|
ticket = a[1];
|
||||||
|
try {
|
||||||
|
tx = new Transaction(login);
|
||||||
|
if (tx.login(login, ticket)) {
|
||||||
|
// login successful
|
||||||
|
module = new GenericModuleImpl(tx);
|
||||||
|
|
||||||
|
// read arguments
|
||||||
|
BufferedReader read = req.getReader();
|
||||||
|
|
||||||
|
String tmpbuf;
|
||||||
|
ArrayList<String> arguments = new ArrayList<String>();
|
||||||
|
while ((tmpbuf = read.readLine()) != null) {
|
||||||
|
arguments.add(tmpbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// actually handle the request and write result to output
|
||||||
|
String output = parser.parse(arguments, module);
|
||||||
|
resp.getWriter().write(output);
|
||||||
|
} else {
|
||||||
|
resp.addHeader("X-hsadmin-error", "authentication failed");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
resp.addHeader("X-hsadmin-error", "exception: " + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (tx != null) {
|
||||||
|
tx.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
hsarback/src/de/hsadmin/cliClientConnector/ModuleModel.java
Normal file
19
hsarback/src/de/hsadmin/cliClientConnector/ModuleModel.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
public class ModuleModel {
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public ModuleModel(String name, String description) {
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class OidsNotFoundException
|
||||||
|
extends RuntimeException
|
||||||
|
{
|
||||||
|
static private String oidsAsString(List<String> oids)
|
||||||
|
{
|
||||||
|
StringBuilder oidsBuilder = new StringBuilder();
|
||||||
|
for ( String id: oids )
|
||||||
|
oidsBuilder.append(", " + id);
|
||||||
|
if ( oidsBuilder.length() > 0 )
|
||||||
|
return oidsBuilder.substring(2);
|
||||||
|
throw new RuntimeException( "an empty list of missing OIDS does not make sense" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public OidsNotFoundException(List<String> oids)
|
||||||
|
{
|
||||||
|
super("OIDS not found: " + oidsAsString(oids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import javax.naming.NamingException;
|
||||||
|
import javax.persistence.RollbackException;
|
||||||
|
|
||||||
|
public class TechnicalException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public TechnicalException(Throwable e) {
|
||||||
|
super(extractCauseMessage(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(String errorMsg) {
|
||||||
|
super(errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TechnicalException(String errorMsg, NamingException e) {
|
||||||
|
super(errorMsg + "\n" + extractCauseMessage(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String extractCauseMessage(Throwable e) {
|
||||||
|
if (e.getMessage() != null && !(e instanceof RollbackException)) {
|
||||||
|
return e.getMessage();
|
||||||
|
}
|
||||||
|
else if (e instanceof InvocationTargetException || e instanceof RollbackException) {
|
||||||
|
String sqlState = null;
|
||||||
|
Throwable cause = e.getCause();
|
||||||
|
Throwable prev = null;
|
||||||
|
while (cause != null && cause != prev) {
|
||||||
|
prev = cause;
|
||||||
|
cause = prev.getCause();
|
||||||
|
if ((cause == null || cause == prev)
|
||||||
|
&& prev instanceof SQLException) {
|
||||||
|
SQLException sqlExc = (SQLException) prev;
|
||||||
|
sqlState = sqlExc.getSQLState();
|
||||||
|
cause = sqlExc.getNextException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cause == null)
|
||||||
|
cause = prev;
|
||||||
|
if (cause != null)
|
||||||
|
return composeMessage(sqlState, cause.getMessage());
|
||||||
|
if (e instanceof InvocationTargetException) {
|
||||||
|
return composeMessage(sqlState, ((InvocationTargetException) e).getTargetException().getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e.getClass() + " without detail message";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String composeMessage(String sqlState, String message) {
|
||||||
|
if (sqlState != null) return "SQLSTATE[" + sqlState + "] " + message;
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
14
hsarback/src/de/hsadmin/cliClientConnector/VersionModel.java
Normal file
14
hsarback/src/de/hsadmin/cliClientConnector/VersionModel.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package de.hsadmin.cliClientConnector;
|
||||||
|
|
||||||
|
public class VersionModel
|
||||||
|
{
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public VersionModel( String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return this.version;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user