Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ullrich Schwanke
acsjavaexamples
Commits
5d530fb5
Commit
5d530fb5
authored
Oct 08, 2021
by
UllrichSchwanke
Browse files
guess
parent
4ea8c954
Changes
10
Hide whitespace changes
Inline
Side-by-side
idl/TestClass.idl
0 → 100644
View file @
5d530fb5
/*
*
Copyright
(
c
)
2018
,
CTA
collaboration
.
All
rights
reserved
.
*
*
@
author
schwanke
(
HU
)
*
*/
#
ifndef
_CTA_TEST_CLASS_IDL_
#
define
_CTA_TEST_CLASS_IDL_
#
include
<
baci
.
idl>
#
pragma
prefix
"cta"
module
dcmsttel
{
//
a
very
simple
component
interface
TestClass
:
ACS
::
ACSComponent
{
string
sayHello
()
;
string
sayHelloWithParameters
(
in
string
inString
,
inout
double
inoutDouble
,
out
long
outInt
)
;
long
switchState
()
;
}
;
}
;
#
endif
src/Makefile
0 → 100644
View file @
5d530fb5
#*******************************************************************************
# PPPPPPPP
#
# "@(#) $Id$"
#
# Makefile of ........
#
# who when what
# -------- -------- ----------------------------------------------
# vagrant 26/08/20 created
#
# ALMA - Atacama Large Millimeter Array
# Copyright (c) ESO - European Southern Observatory, 2014
# (in the framework of the ALMA collaboration).
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#*******************************************************************************
#*******************************************************************************
# This Makefile follows ALMA/ACS Standards (see Makefile(5) for more).
#*******************************************************************************
# REMARKS
# None
#------------------------------------------------------------------------
#
# user definable C-compilation flags
#USER_CFLAGS =
#
# additional include and library search paths
#USER_INC =
#USER_LIB =
#
# MODULE CODE DESCRIPTION:
# ------------------------
# As a general rule: public file are "cleaned" and "installed"
# local (_L) are not "installed".
#
# C programs (public and local)
# -----------------------------
EXECUTABLES
=
EXECUTABLES_L
=
#
# <brief description of xxxxx program>
xxxxx_OBJECTS
=
xxxxx_LDFLAGS
=
xxxxx_LIBS
=
#
# special compilation flags for single c sources
#yyyyy_CFLAGS =
#
# Includes (.h) files (public only)
# ---------------------------------
INCLUDES
=
#
# Libraries (public and local)
# ----------------------------
LIBRARIES
=
LIBRARIES_L
=
#
# <brief description of lllll library>
lllll_OBJECTS
=
#
# Scripts (public and local)
# ----------------------------
SCRIPTS
=
SCRIPTS_L
=
#
# TCL scripts (public and local)
# ------------------------------
TCL_SCRIPTS
=
TCL_SCRIPTS_L
=
#
# Python stuff (public and local)
# ----------------------------
PY_SCRIPTS
=
PY_SCRIPTS_L
=
PY_MODULES
=
PY_MODULES_L
=
PY_PACKAGES
=
PY_PACKAGES_L
=
pppppp_MODULES
=
#
# <brief description of tttttt tcl-script>
tttttt_OBJECTS
=
tttttt_TCLSH
=
tttttt_LIBS
=
#
# TCL libraries (public and local)
# ------------------------------
TCL_LIBRARIES
=
TCL_LIBRARIES_L
=
#
# <brief description of tttlll library>
tttlll_OBJECTS
=
#
# Configuration Database Files
# ----------------------------
CDB_SCHEMAS
=
#
# IDL Files and flags
#
IDL_FILES
=
TestClass
TAO_IDLFLAGS
=
USER_IDL
=
#
# Jarfiles and their directories
#
JARFILES
=
javaExample
javaExample_DIRS
=
cta
jjj_EXTRAS
=
# For expressing dependencies between jarfiles (parallel builds)
jjj_JLIBS
=
#
# java sources in Jarfile on/off
DEBUG
=
#
# ACS XmlIdl generation on/off
#
XML_IDL
=
#
# Java Component Helper Classes generation on/off
#
COMPONENT_HELPERS
=
#
# Java Entity Classes generation on/off
#
XSDBIND
=
#
# Schema Config files for the above
#
XSDBIND_INCLUDE
=
# man pages to be done
# --------------------
MANSECTIONS
=
MAN1
=
MAN3
=
MAN5
=
MAN7
=
MAN8
=
#
# local man pages
# ---------------
MANl
=
#
# ASCII file to be converted into Framemaker-MIF
# --------------------
ASCII_TO_MIF
=
#
# other files to be installed
#----------------------------
INSTALL_FILES
=
#
# list of all possible C-sources (used to create automatic dependencies)
# ------------------------------
CSOURCENAMES
=
\
$(
foreach
exe,
$(EXECUTABLES)
$(EXECUTABLES_L)
,
$
(
$(exe)
_OBJECTS
))
\
$(
foreach
rtos,
$(RTAI_MODULES)
,
$
(
$(rtos)
_OBJECTS
))
\
$(
foreach
lib,
$(LIBRARIES)
$(LIBRARIES_L)
,
$
(
$(lib)
_OBJECTS
))
#
#>>>>> END OF standard rules
#
# INCLUDE STANDARDS
# -----------------
MAKEDIRTMP
:=
$(
shell
searchFile include/acsMakefile
)
ifneq
($(MAKEDIRTMP),\
#error\#)
MAKEDIR
:=
$(MAKEDIRTMP)
/include
include
$(MAKEDIR)/acsMakefile
endif
#
# TARGETS
# -------
all
:
do_all
@
echo
" . . . 'all' done"
clean
:
clean_all
@
echo
" . . . clean done"
clean_dist
:
clean_all clean_dist_all
@
echo
" . . . clean_dist done"
man
:
do_man
@
echo
" . . . man page(s) done"
install
:
install_all
@
echo
" . . . installation done"
#___oOo___
src/cta/dcmsttel/TestClassImpl/TestClassComponentHelper.java
0 → 100644
View file @
5d530fb5
/*
* ALMA - Atacama Large Millimiter Array
* (c) European Southern Observatory, 2002
* Copyright by ESO (in the framework of the ALMA collaboration),
* All rights reserved
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
package
cta.dcmsttel.TestClassImpl
;
import
java.util.logging.Logger
;
import
org.omg.PortableServer.Servant
;
import
alma.ACS.ACSComponentOperations
;
import
alma.acs.component.ComponentLifecycle
;
import
alma.acs.container.ComponentHelper
;
import
cta.dcmsttel.TestClassOperations
;
import
cta.dcmsttel.TestClassPOATie
;
import
cta.dcmsttel.TestClassImpl.TestClassImpl
;
/**
* Component helper class.
* Generated for convenience, but can be modified by the component developer.
* Must therefore be treated like any other Java class (CVS, ...).
* <p>
* To create an entry for your component in the Configuration Database,
* copy the line below into a new entry in the file $ACS_CDB/MACI/Components/Components.xml
* and modify the instance name of the component and the container:
* <p>
* Name="TESTCLASS_1" Code="cta.dcmsttel.TestClassImpl.TestClassComponentHelper" Type="IDL:cta/dcmsttel/TestClass:1.0" Container="frodoContainer" ImplLang="java"
* <p>
* @author alma-component-helper-generator-tool
*/
public
class
TestClassComponentHelper
extends
ComponentHelper
{
/**
* Constructor
* @param containerLogger logger used only by the parent class.
*/
public
TestClassComponentHelper
(
Logger
containerLogger
)
{
super
(
containerLogger
);
}
/**
* @see alma.acs.container.ComponentHelper#_createComponentImpl()
*/
protected
ComponentLifecycle
_createComponentImpl
()
{
return
new
TestClassImpl
();
}
/**
* @see alma.acs.container.ComponentHelper#_getPOATieClass()
*/
protected
Class
<?
extends
Servant
>
_getPOATieClass
()
{
return
TestClassPOATie
.
class
;
}
/**
* @see alma.acs.container.ComponentHelper#getOperationsInterface()
*/
protected
Class
<?
extends
ACSComponentOperations
>
_getOperationsInterface
()
{
return
TestClassOperations
.
class
;
}
}
src/cta/dcmsttel/TestClassImpl/TestClassImpl.java
0 → 100644
View file @
5d530fb5
/*
* Copyright (c) 2020, CTA collaboration. All rights reserved.
*
* @author Schwanke (HU)
*/
package
cta.dcmsttel.TestClassImpl
;
import
java.util.logging.Logger
;
import
si.ijs.maci.ComponentSpec
;
import
org.omg.CORBA.DoubleHolder
;
import
org.omg.CORBA.IntHolder
;
import
alma.ACS.ComponentStates
;
import
alma.acs.component.ComponentLifecycle
;
import
alma.acs.component.ComponentQueryDescriptor
;
import
alma.acs.container.ContainerServices
;
import
cta.dcmsttel.TestClassOperations
;
import
cta.dcmsttel.TestClass
;
import
java.lang.Integer
;
/**
* A very simple component that does not make use of
* {@link alma.acs.component.ComponentImplBase}.
*
* Javadoc comments have been removed to keep the
* listing for the tutorial shorter.
*
* @author hsommer
*/
public
class
TestClassImpl
implements
ComponentLifecycle
,
TestClassOperations
{
private
ContainerServices
m_containerServices
;
private
Logger
m_logger
;
private
Integer
m_state
;
/////////////////////////////////////////////////////////////
// Implementation of ComponentLifecycle
/////////////////////////////////////////////////////////////
public
void
initialize
(
ContainerServices
containerServices
)
{
m_containerServices
=
containerServices
;
m_logger
=
m_containerServices
.
getLogger
();
m_logger
.
info
(
"initialize() called..."
);
m_state
=
0
;
}
public
void
execute
()
{
m_logger
.
info
(
"execute() called..."
);
}
public
void
cleanUp
()
{
m_logger
.
info
(
"cleanUp() called..., nothing to clean up."
);
}
public
void
aboutToAbort
()
{
cleanUp
();
m_logger
.
info
(
"managed to abort..."
);
System
.
out
.
println
(
"HelloDemo component managed to abort... you should know this even if the logger did not flush correctly!"
);
}
/////////////////////////////////////////////////////////////
// Implementation of ACSComponent
/////////////////////////////////////////////////////////////
public
ComponentStates
componentState
()
{
return
m_containerServices
.
getComponentStateManager
().
getCurrentState
();
}
public
String
name
()
{
return
m_containerServices
.
getName
();
}
/////////////////////////////////////////////////////////////
// Implementation of HelloDemoOperations
/////////////////////////////////////////////////////////////
public
String
sayHello
()
{
m_logger
.
info
(
"sayHello called..."
+
name
());
return
"hello"
;
}
public
String
sayHelloWithParameters
(
String
inString
,
DoubleHolder
inoutDouble
,
IntHolder
outInt
)
{
m_logger
.
info
(
"sayHello called with arguments inString="
+
inString
+
"; inoutDouble="
+
inoutDouble
.
value
+
". Will return 'hello'..."
);
outInt
.
value
=
(
int
)
Math
.
round
(
Math
.
E
*
10000000
);
return
"hello"
;
}
public
int
switchState
(){
m_logger
.
info
(
"Change state from "
+
Integer
.
toString
(
m_state
)+
" to "
+
Integer
.
toString
(
m_state
+
1
));
m_state
=
m_state
+
1
;
return
m_state
;
}
}
test/CDB/MACI/Components/Components.xml
0 → 100644
View file @
5d530fb5
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
- Configuration for a TestClass
-->
<Components
xmlns=
"urn:schemas-cosylab-com:Components:1.0"
xmlns:cdb=
"urn:schemas-cosylab-com:CDB:1.0"
xmlns:baci=
"urn:schemas-cosylab-com:BACI:1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<e
Name=
"TESTCLASS"
Code=
"cta.dcmsttel.TestClassImpl.TestClassComponentHelper"
Type=
"IDL:cta/dcmsttel/TestClass:1.0"
Container=
"Mst_Container"
ImplLang=
"java"
KeepAliveTime=
"-1"
/>
</Components>
test/CDB/MACI/Containers/Mst_Container/Mst_Container.xml
0 → 100755
View file @
5d530fb5
<?xml version="1.0" encoding="ISO-8859-1"?>
<Container
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"urn:schemas-cosylab-com:Container:1.0"
xmlns:log=
"urn:schemas-cosylab-com:LoggingConfig:1.0"
ImplLang=
"java"
>
<Autoload>
</Autoload>
<DeployInfo
Host=
"actl-dev-vm.localdomain"
Flags=
""
KeepAliveTime=
"10000"
StartOnDemand=
"true"
/>
<LoggingConfig
centralizedLogger=
"Log"
minLogLevel=
"2"
dispatchPacketSize=
"10"
immediateDispatchLevel=
"99"
>
</LoggingConfig>
</Container>
test/CDB/MACI/Containers/Mst_ContainerPy/Mst_ContainerPy.xml
0 → 100755
View file @
5d530fb5
<?xml version="1.0" encoding="ISO-8859-1"?>
<Container
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"urn:schemas-cosylab-com:Container:1.0"
xmlns:log=
"urn:schemas-cosylab-com:LoggingConfig:1.0"
ImplLang=
"py"
>
<Autoload>
</Autoload>
<DeployInfo
Host=
"actl-dev-vm.localdomain"
Flags=
""
KeepAliveTime=
"100000"
StartOnDemand=
"true"
/>
<LoggingConfig
centralizedLogger=
"Log"
minLogLevel=
"2"
dispatchPacketSize=
"10"
immediateDispatchLevel=
"99"
>
</LoggingConfig>
</Container>
test/CDB/MACI/Managers/Manager/Manager.xml
0 → 100755
View file @
5d530fb5
<?xml version="1.0" encoding="ISO-8859-1"?>
<Manager
xmlns:cdb=
"urn:schemas-cosylab-com:CDB:1.0"
xmlns=
"urn:schemas-cosylab-com:Manager:1.0"
xmlns:baci=
"urn:schemas-cosylab-com:BACI:1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
Timeout=
"50.0"
ClientPingInterval=
"2.0"
ContainerPingInterval=
"2.0"
AdministratorPingInterval=
"2.0"
>
<Startup>
</Startup>
<ServiceComponents>
<cdb:e
string=
"Log"
/>
<cdb:e
string=
"LogFactory"
/>
<cdb:e
string=
"NotifyEventChannelFactory"
/>
<cdb:e
string=
"ArchivingChannel"
/>
<cdb:e
string=
"LoggingChannel"
/>
<cdb:e
string=
"InterfaceRepository"
/>
<cdb:e
string=
"CDB"
/>
<cdb:e
string=
"ACSLogSvc"
/>
<cdb:e
string=
"PDB"
/>
</ServiceComponents>
<LoggingConfig
minLogLevel=
"2"
immediateDispatchLevel=
"99"
dispatchPacketSize=
"0"
/>
</Manager>
test/runMe
0 → 100644
View file @
5d530fb5
acsStopContainer Mst_Container
acsStartContainer -java Mst_Container
test/test.py
0 → 100644
View file @
5d530fb5
from
Acspy.Clients.SimpleClient
import
PySimpleClient
import
ACS
,
ACS__POA
name
=
"TESTCLASS"
simpleClient
=
PySimpleClient
()
s
=
simpleClient
.
getComponent
(
name
)
print
(
s
.
sayHello
())
print
(
"switchState() = "
,
s
.
switchState
())
simpleClient
.
releaseComponent
(
name
)
print
(
"done"
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment