Skip to content

Refresh java bindings #1277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: e2ens
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ TCP_UDP_BUFFER_SIZE=1500
INSTALL_PREFIX="/"
KERNBUILDDIR="/lib/modules/`uname -r`/build"
BUILD_USER="y"
JAVA_BINDINGS_OPTION="--disable-java-bindings"

# Option parsing
while [[ $# > 0 ]]
Expand Down Expand Up @@ -47,6 +48,10 @@ do
BUILD_USER="n"
;;

"--enable-java-bindings")
JAVA_BINDINGS_OPTION="$1"
;;

*)
echo "Unknown option '$key'"
exit 255
Expand Down Expand Up @@ -100,7 +105,7 @@ echo "Starting librina phase"
echo "Cannot bootstrap"
exit 1
}
(mkdir -p $BUILDDIR/librina && cd $BUILDDIR/librina && $SRCDIR/librina/configure --disable-java-bindings $FLAGS --prefix=$INSTALL_PREFIX && make clean install) || {
(mkdir -p $BUILDDIR/librina && cd $BUILDDIR/librina && $SRCDIR/librina/configure $JAVA_BINDINGS_OPTION $FLAGS --prefix=$INSTALL_PREFIX && make clean install) || {
echo "Cannot complete librina phase"
exit 1
}
Expand All @@ -110,7 +115,7 @@ echo "Starting rinad phase"
echo "Cannot bootstrap"
exit 1
}
(mkdir -p $BUILDDIR/rinad && cd $BUILDDIR/rinad && PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig LD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$LD_LIBRARY_PATH $SRCDIR/rinad/configure --prefix=$INSTALL_PREFIX --disable-java-bindings $FLAGS && make clean install) || {
(mkdir -p $BUILDDIR/rinad && cd $BUILDDIR/rinad && PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig LD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$LD_LIBRARY_PATH $SRCDIR/rinad/configure --prefix=$INSTALL_PREFIX $JAVA_BINDINGS_OPTION $FLAGS && make clean install) || {
echo "Cannot complete rinad phase"
echo "LIBRINA Version ="
pkg-config --modversion librina
Expand Down
6 changes: 3 additions & 3 deletions librina/wrap/java/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

if BUILD_BINDINGS_JAVA

JAVA_DIR = $(top_builddir)/../java
SWIG_DEBUG = -v
SWIG_CPPFLAGS = -I$(top_srcdir)/include
Expand Down Expand Up @@ -38,7 +38,7 @@ CLEANFILES += librina_java.cc+
librina-java-classes: wrap.stamp
$(JAVAC) $(JAVA_DIR)/eu/irati/librina/*.java

librina.jar: librina-java-classes
librina.jar: librina-java-classes
cd $(JAVA_DIR) && \
$(JAR) -cvf librina.jar eu/irati/librina/*.class
mv $(JAVA_DIR)/librina.jar $(builddir)
Expand All @@ -54,7 +54,7 @@ librina_java.cc: wrap.stamp
librina_java_la_SOURCES = librina_java.cc
librina_java_la_LDFLAGS = -module
librina_java_la_LIBADD = $(top_builddir)/src/librina.la
librina_java_la_CPPFLAGS = -I$(top_srcdir)/include $(JNI_CPPFLAGS)
librina_java_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(JNI_CPPFLAGS)

lib_LTLIBRARIES = librina_java.la

Expand Down
50 changes: 48 additions & 2 deletions librina/wrap/librina.i
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
$result = jenv->NewObject(clazz, mid, cptr, false);
}
}
} else if ($1->eventType == rina::DEALLOCATE_FLOW_RESPONSE_EVENT) {
}
/*else if ($1->eventType == rina::DEALLOCATE_FLOW_RESPONSE_EVENT) {
rina::DeallocateFlowResponseEvent *flowReqEvent = dynamic_cast<rina::DeallocateFlowResponseEvent *>($1);
jclass clazz = jenv->FindClass("eu/irati/librina/DeallocateFlowResponseEvent");
if (clazz) {
Expand All @@ -425,7 +426,8 @@ SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
$result = jenv->NewObject(clazz, mid, cptr, false);
}
}
} else if ($1->eventType == rina::GET_DIF_PROPERTIES_RESPONSE_EVENT) {
}*/
else if ($1->eventType == rina::GET_DIF_PROPERTIES_RESPONSE_EVENT) {
rina::GetDIFPropertiesResponseEvent *flowReqEvent = dynamic_cast<rina::GetDIFPropertiesResponseEvent *>($1);
jclass clazz = jenv->FindClass("eu/irati/librina/GetDIFPropertiesResponseEvent");
if (clazz) {
Expand Down Expand Up @@ -503,6 +505,50 @@ DOWNCAST_IPC_EVENT_CONSUMER(eventTimedWait);
%rename(equals) rina::QoSCube::operator==(const QoSCube &other) const;
%rename(differs) rina::QoSCube::operator!=(const QoSCube &other) const;
%rename(assign) rina::EFCPConfiguration::operator=(const EFCPConfiguration &other);
%rename(equals) rina::DTCPWindowBasedFlowControlConfig::operator==(const DTCPWindowBasedFlowControlConfig &other) const;
%rename(differs) rina::DTCPWindowBasedFlowControlConfig::operator!=(const DTCPWindowBasedFlowControlConfig &other) const;
%rename(equals) rina::DTCPRateBasedFlowControlConfig::operator==(const DTCPRateBasedFlowControlConfig &other) const;
%rename(differs) rina::DTCPRateBasedFlowControlConfig::operator!=(const DTCPRateBasedFlowControlConfig &other) const;
%rename(equals) rina::DTCPFlowControlConfig::operator==(const DTCPFlowControlConfig &other) const;
%rename(differs) rina::DTCPFlowControlConfig::operator!=(const DTCPFlowControlConfig &other) const;
%rename(equals) rina::DTCPRtxControlConfig::operator==(const DTCPRtxControlConfig &other) const;
%rename(differs) rina::DTCPRtxControlConfig::operator!=(const DTCPRtxControlConfig &other) const;
%rename(equals) rina::DTCPConfig::operator==(const DTCPConfig &other) const;
%rename(differs) rina::DTCPConfig::operator!=(const DTCPConfig &other) const;
%rename(equals) rina::DTPConfig::operator==(const DTPConfig &other) const;
%rename(differs) rina::DTPConfig::operator!=(const DTPConfig &other) const;
%rename(equals) rina::QoSCube::operator==(const QoSCube &other) const;
%rename(differs) rina::QoSCube::operator!=(const QoSCube &other) const;
%rename(equals) rina::DataTransferConstants::operator==(const DataTransferConstants &other) const;
%rename(differs) rina::DataTransferConstants::operator!=(const DataTransferConstants &other) const;
%rename(equals) rina::EFCPConfiguration::operator==(const EFCPConfiguration &other) const;
%rename(differs) rina::EFCPConfiguration::operator!=(const EFCPConfiguration &other) const;
%rename(equals) rina::FlowAllocatorConfiguration::operator==(const FlowAllocatorConfiguration &other) const;
%rename(differs) rina::FlowAllocatorConfiguration::operator!=(const FlowAllocatorConfiguration &other) const;
%rename(equals) rina::PDUFTGConfiguration::operator==(const PDUFTGConfiguration &other) const;
%rename(differs) rina::PDUFTGConfiguration::operator!=(const PDUFTGConfiguration &other) const;
%rename(equals) rina::ResourceAllocatorConfiguration::operator==(const ResourceAllocatorConfiguration &other) const;
%rename(differs) rina::ResourceAllocatorConfiguration::operator!=(const ResourceAllocatorConfiguration &other) const;
%rename(equals) rina::PFTConfiguration::operator==(const PFTConfiguration &other) const;
%rename(differs) rina::PFTConfiguration::operator!=(const PFTConfiguration &other) const;
%rename(equals) rina::RMTConfiguration::operator==(const RMTConfiguration &other) const;
%rename(differs) rina::RMTConfiguration::operator!=(const RMTConfiguration &other) const;
%rename(equals) rina::EnrollmentTaskConfiguration::operator==(const EnrollmentTaskConfiguration &other) const;
%rename(differs) rina::EnrollmentTaskConfiguration::operator!=(const EnrollmentTaskConfiguration &other) const;
%rename(equals) rina::AddressingConfiguration::operator==(const AddressingConfiguration &other) const;
%rename(differs) rina::AddressingConfiguration::operator!=(const AddressingConfiguration &other) const;
%rename(equals) rina::NamespaceManagerConfiguration::operator==(const NamespaceManagerConfiguration &other) const;
%rename(differs) rina::NamespaceManagerConfiguration::operator!=(const NamespaceManagerConfiguration &other) const;
%rename(equals) rina::AuthSDUProtectionProfile::operator==(const AuthSDUProtectionProfile &other) const;
%rename(differs) rina::AuthSDUProtectionProfile::operator!=(const AuthSDUProtectionProfile &other) const;
%rename(equals) rina::SecurityManagerConfiguration::operator==(const SecurityManagerConfiguration &other) const;
%rename(differs) rina::SecurityManagerConfiguration::operator!=(const SecurityManagerConfiguration &other) const;
%rename(equals) rina::RoutingConfiguration::operator==(const RoutingConfiguration &other) const;
%rename(differs) rina::RoutingConfiguration::operator!=(const RoutingConfiguration &other) const;
%rename(equals) rina::DIFConfiguration::operator==(const DIFConfiguration &other) const;
%rename(differs) rina::DIFConfiguration::operator!=(const DIFConfiguration &other) const;



/* This is for separating rib::init and rib::fini from cdap::init and cdap::fini */
%rename(cdap_init) rina::cdap::init(cdap::CDAPCallbackInterface *callback, cdap_rib::concrete_syntax_t& syntax, int fd);
Expand Down
27 changes: 13 additions & 14 deletions rinad/wrap/java/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,41 @@ SWIG_JAVA_FLAGS = -java -package eu.irati.librinad

CLEANFILES =

# XXX FIXME: Prerequisites for this rule are broken ...
wrap.stamp: $(top_srcdir)/wrap/*.i $(top_srcdir)/src/common/*.h
rm -f wrap.tmp
rm -f wrap.tmp
touch wrap.tmp
rm -r -f $(JAVA_DIR)/eu/irati/librinad && \
$(MKDIR_P) $(JAVA_DIR)/eu/irati/librinad && \
$(SWIG) $(SWIG_FLAGS) $(SWIG_JAVA_FLAGS) \
$(MKDIR_P) $(JAVA_DIR)/eu/irati/librinad && \
$(SWIG) $(SWIG_FLAGS) $(SWIG_JAVA_FLAGS) \
-c++ \
-o librinad_java.cc \
-outdir $(JAVA_DIR)/eu/irati/librinad \
$(top_srcdir)/wrap/librinad.i || { \
echo "Cannot wrap input file" ; \
echo "Cannot wrap input file" ; \
rm -f wrap.tmp ; \
rm -r -f $(JAVA_DIR)/eu/irati/librinad ; \
rm -r -f $(JAVA_DIR)/eu/irati/librinad ; \
exit 1 ; \
}
mv -f wrap.tmp $@

CLEANFILES += wrap.stamp wrap.tmp
CLEANFILES += librinad_java.cc

librinad-java-classes: wrap.stamp
librinad-java-classes: wrap.stamp
$(JAVAC) -cp $(JAVA_DIR) $(JAVA_DIR)/eu/irati/librinad/*.java

librinad.jar: librinad-java-classes
cd $(JAVA_DIR) && \
$(JAR) -cvf librinad.jar eu/irati/librinad/*.class
mv $(JAVA_DIR)/librinad.jar $(builddir)
mv $(JAVA_DIR)/librinad.jar $(builddir)

CLEANFILES += librinad.jar

pkgdata_DATA = librinad.jar

clean-local:
rm -r -f $(JAVA_DIR)/eu/irati/librinad

clean-local:
rm -r -f $(JAVA_DIR)/eu/irati/librinad
librinad_java.cc: wrap.stamp

librinad_java_la_SOURCES = librinad_java.cc
Expand All @@ -69,7 +68,7 @@ install-data-local-maven: librinad.jar
echo "Cannot install librinad jar into maven ..." ; \
exit 1 ; \
}

install-data-local: install-data-local-maven
install-data-local: install-data-local-maven

endif
Loading