Commit fb1fc482 authored by yannick legoc's avatar yannick legoc
Browse files

Replaced corba server connection with cameo.

parent 771ef01c
......@@ -157,98 +157,11 @@
<phase>process-resources</phase>
<configuration>
<target>
<property name="idlFlags" value="-d src/main/java -sloppy_forward" />
<property name="idlCommonDir" value="${env.NOMAD_HOME}/src/common/corba/idl/common" />
<property name="idlDataProviderDir" value="${env.NOMAD_HOME}/src/common/corba/idl/dataprovider" />
<property name="idlCoreDir" value="${env.NOMAD_HOME}/src/common/corba/idl/core" />
<property name="idlClientDir" value="${env.NOMAD_HOME}/src/common/corba/idl/client" />
<property name="idlNomadClientLibDir" value="${env.NOMADCLIENT_HOME}/lib/common" />
<property name="idlNomadClientLib64Dir" value="${env.NOMADCLIENT_HOME}/lib64/common" />
<property name="clientSrcDir" value="${env.NOMADCLIENT_HOME}/src" />
<property name="serverSrcDir" value="${env.NOMAD_HOME}/src" />
<property name="serverLibDir" value="${env.NOMAD_HOME}/lib" />
<property name="clientCalculatorLibDir" value="${env.NOMADCLIENT_HOME}/lib/common/calculator" />
<property name="clientCalculatorLib64Dir" value="${env.NOMADCLIENT_HOME}/lib64/common/calculator" />
<property name="protoFlags" value="-I${env.NOMAD_HOME}/src/common/protobuf/proto --java_out=src/main/java" />
<property name="protoDir" value="${env.NOMAD_HOME}/src/common/protobuf/proto" />
<delete dir="src/main/java/fr/ill/ics/nomadserver" />
<!-- core -->
<echo message="Generating CORBA files" />
<echo message="" />
<echo message="Generating ConnectionToken.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlClientDir}/ConnectionToken.idl" />
</exec>
<echo message="Generating SessionManager.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCoreDir}/SessionManager.idl" />
</exec>
<echo message="Generating SessionGateway.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCoreDir}/SessionGateway.idl" />
</exec>
<!-- common -->
<echo message="Generating ListIterator.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/ListIterator.idl" />
</exec>
<echo message="Generating ListItem.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/ListItem.idl" />
</exec>
<echo message="Generating BaseArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/BaseArrayTransferService.idl" />
</exec>
<echo message="Generating Int8ArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Int8ArrayTransferService.idl" />
</exec>
<echo message="Generating Int16ArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Int16ArrayTransferService.idl" />
</exec>
<echo message="Generating Int32ArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Int32ArrayTransferService.idl" />
</exec>
<echo message="Generating Int64ArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Int64ArrayTransferService.idl" />
</exec>
<echo message="Generating Float32ArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Float32ArrayTransferService.idl" />
</exec>
<echo message="Generating Float64ArrayTransferService.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Float64ArrayTransferService.idl" />
</exec>
<echo message="Generating ArrayCopier.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/ArrayCopier.idl" />
</exec>
<echo message="Generating Sequences.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/Sequences.idl" />
</exec>
<!-- proto files -->
<echo message="Generating ServantConfiguration.java" />
<exec executable="protoc">
......@@ -289,6 +202,11 @@
<exec executable="protoc">
<arg line="${protoFlags} ${protoDir}/CommandZoneRequests.proto" />
</exec>
<echo message="Generating SessionRequests.java" />
<exec executable="protoc">
<arg line="${protoFlags} ${protoDir}/SessionRequests.proto" />
</exec>
</target>
</configuration>
......
......@@ -24,7 +24,7 @@ import fr.ill.ics.nscclient.corbabase.CorbaNamingService;
import fr.ill.ics.nscclient.corbabase.CorbaORB;
import fr.ill.ics.nscclient.servant.ConfigurationManager.LoadFailure;
import fr.ill.ics.nscclient.serverconnection.ServerConnection;
import fr.ill.ics.nscclient.sessionmanagement.CorbaSessionManager;
import fr.ill.ics.nscclient.sessionmanagement.SessionManager;
import fr.ill.ics.nscclient.sessionmanagement.ServerSessionManager;
public class LoginManager {
......@@ -66,7 +66,7 @@ public class LoginManager {
public void login(String login, String password, boolean standalone, String serverId) throws LoginIncorrectException, ClientAlreadyLaunchedException, ConnectionFailure {
try {
ServerSessionManager.getInstance(serverId).login(standalone);
} catch (CorbaSessionManager.ClientAlreadyLaunchedException e) {
} catch (SessionManager.ClientAlreadyLaunchedException e) {
throw new ClientAlreadyLaunchedException();
} catch (ServerSessionManager.ConnectionFailure e) {
throw new ConnectionFailure();
......@@ -79,7 +79,7 @@ public class LoginManager {
public void logintab(String login, String password, boolean standalone, String serverId) throws LoginIncorrectException, ClientAlreadyLaunchedException, ConnectionFailure {
try {
ServerSessionManager.getInstance(serverId).logintab(standalone);
} catch (CorbaSessionManager.ClientAlreadyLaunchedException e) {
} catch (SessionManager.ClientAlreadyLaunchedException e) {
throw new ClientAlreadyLaunchedException();
} catch (ServerSessionManager.ConnectionFailure e) {
throw new ConnectionFailure();
......
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.dataprovider.arraycopier;
import java.util.logging.Level;
import java.util.logging.Logger;
import fr.ill.ics.nomadserver.common.ArrayCopier;
import fr.ill.ics.nomadserver.common.ArrayCopierHelper;
import fr.ill.ics.nomadserver.common.ArrayCopierPOA;
import fr.ill.ics.nscclient.corbabase.CorbaORB;
import fr.ill.ics.nscclient.dataprovider.arraytranserservice.Float32ArrayTransferServiceImpl;
public abstract class ArrayCopierImpl extends ArrayCopierPOA {
private static final Logger LOGGER = Logger.getLogger(Float32ArrayTransferServiceImpl.class.getName());
protected static final int MAX_TRANSFER_SIZE_BYTES = 1024;
private org.omg.CORBA.Object corbaObject;
private ArrayCopier arrayCopier ;
public void activate() {
try {
corbaObject = CorbaORB.getInstance().getPOA().servant_to_reference(this);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Problem activating corba object");
}
arrayCopier = ArrayCopierHelper.narrow(corbaObject);
}
public void deactivate() {
// Free corba object
try {
byte[] id = CorbaORB.getInstance().getPOA().reference_to_id(corbaObject);
CorbaORB.getInstance().getPOA().deactivate_object(id);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Problem deactivating corba object");
}
}
public ArrayCopier getCorbaArrayCopier() {
return arrayCopier;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.dataprovider.arraycopier;
import fr.ill.ics.nomadserver.common.BaseArrayTransferService;
import fr.ill.ics.nomadserver.common.Float32ArrayTransferService;
import fr.ill.ics.nomadserver.common.Float32ArrayTransferServiceHelper;
public class Float32ArrayCopierImpl extends ArrayCopierImpl {
private static final int TYPE_SIZE = 4;
private float[] data;
public Float32ArrayCopierImpl(float[] data) {
this.data = data;
}
public void fillArray(BaseArrayTransferService arrayTransferService) {
Float32ArrayTransferService float32ArrayTransferService = Float32ArrayTransferServiceHelper.narrow(arrayTransferService);
int arraySize = data.length;
int maxBufferSizeBytes = MAX_TRANSFER_SIZE_BYTES;
int maxNumberOfElements = maxBufferSizeBytes/TYPE_SIZE;
// Allocating buffer with max size
float[] buffer = new float[maxNumberOfElements];
float32ArrayTransferService.setNumberOfElements(arraySize);
int index = 0;
int bufferSize;
while (index < arraySize) {
// determine buffer size
if (index + maxNumberOfElements < arraySize) {
bufferSize = maxNumberOfElements;
} else {
bufferSize = arraySize - index;
}
// copy data
for (int i = 0 ; i < bufferSize; i++) {
buffer[i] = data[index + i];
}
// send buffer
float32ArrayTransferService.appendBuffer(bufferSize, buffer);
index = index + bufferSize;
}
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.dataprovider.arraycopier;
import fr.ill.ics.nomadserver.common.BaseArrayTransferService;
import fr.ill.ics.nomadserver.common.Float64ArrayTransferService;
import fr.ill.ics.nomadserver.common.Float64ArrayTransferServiceHelper;
public class Float64ArrayCopierImpl extends ArrayCopierImpl {
private static final int TYPE_SIZE = 8;
private double[] data;
public Float64ArrayCopierImpl(double[] data) {
this.data = data;
}
public void fillArray(BaseArrayTransferService arrayTransferService) {
Float64ArrayTransferService Float64ArrayTransferService = Float64ArrayTransferServiceHelper.narrow(arrayTransferService);
int arraySize = data.length;
int maxBufferSizeBytes = MAX_TRANSFER_SIZE_BYTES;
int maxNumberOfElements = maxBufferSizeBytes/TYPE_SIZE;
// Allocating buffer with max size
double[] buffer = new double[maxNumberOfElements];
Float64ArrayTransferService.setNumberOfElements(arraySize);
int index = 0;
int bufferSize;
while (index < arraySize) {
// determine buffer size
if (index + maxNumberOfElements < arraySize) {
bufferSize = maxNumberOfElements;
} else {
bufferSize = arraySize - index;
}
// copy data
for (int i = 0 ; i < bufferSize; i++) {
buffer[i] = data[index + i];
}
// send buffer
Float64ArrayTransferService.appendBuffer(bufferSize, buffer);
index = index + bufferSize;
}
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.dataprovider.arraycopier;
import fr.ill.ics.nomadserver.common.BaseArrayTransferService;
import fr.ill.ics.nomadserver.common.Int16ArrayTransferService;
import fr.ill.ics.nomadserver.common.Int16ArrayTransferServiceHelper;
public class Int16ArrayCopierImpl extends ArrayCopierImpl {
private static final int TYPE_SIZE = 2;
private short[] data;
public Int16ArrayCopierImpl(short[] data) {
this.data = data;
}
public void fillArray(BaseArrayTransferService arrayTransferService) {
Int16ArrayTransferService Int16ArrayTransferService = Int16ArrayTransferServiceHelper.narrow(arrayTransferService);
int arraySize = data.length;
int maxBufferSizeBytes = MAX_TRANSFER_SIZE_BYTES;
int maxNumberOfElements = maxBufferSizeBytes/TYPE_SIZE;
// Allocating buffer with max size
short[] buffer = new short[maxNumberOfElements];
Int16ArrayTransferService.setNumberOfElements(arraySize);
int index = 0;
int bufferSize;
while (index < arraySize) {
// determine buffer size
if (index + maxNumberOfElements < arraySize) {
bufferSize = maxNumberOfElements;
} else {
bufferSize = arraySize - index;
}
// copy data
for (int i = 0 ; i < bufferSize; i++) {
buffer[i] = data[index + i];
}
// send buffer
Int16ArrayTransferService.appendBuffer(bufferSize, buffer);
index = index + bufferSize;
}
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.dataprovider.arraycopier;
import fr.ill.ics.nomadserver.common.BaseArrayTransferService;
import fr.ill.ics.nomadserver.common.Int32ArrayTransferService;
import fr.ill.ics.nomadserver.common.Int32ArrayTransferServiceHelper;
public class Int32ArrayCopierImpl extends ArrayCopierImpl {
private static final int TYPE_SIZE = 4;
private int[] data;
public Int32ArrayCopierImpl(int[] data) {
this.data = data;
}
public void fillArray(BaseArrayTransferService arrayTransferService) {
Int32ArrayTransferService Int32ArrayTransferService = Int32ArrayTransferServiceHelper.narrow(arrayTransferService);
int arraySize = data.length;
int maxBufferSizeBytes = MAX_TRANSFER_SIZE_BYTES;
int maxNumberOfElements = maxBufferSizeBytes/TYPE_SIZE;
// Allocating buffer with max size
int[] buffer = new int[maxNumberOfElements];
Int32ArrayTransferService.setNumberOfElements(arraySize);
int index = 0;
int bufferSize;
while (index < arraySize) {
// determine buffer size
if (index + maxNumberOfElements < arraySize) {
bufferSize = maxNumberOfElements;
} else {
bufferSize = arraySize - index;
}
// copy data
for (int i = 0 ; i < bufferSize; i++) {
buffer[i] = data[index + i];
}
// send buffer
Int32ArrayTransferService.appendBuffer(bufferSize, buffer);
index = index + bufferSize;
}
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.dataprovider.arraycopier;
import fr.ill.ics.nomadserver.common.BaseArrayTransferService;
import fr.ill.ics.nomadserver.common.Int64ArrayTransferService;
import fr.ill.ics.nomadserver.common.Int64ArrayTransferServiceHelper;
public class Int64ArrayCopierImpl extends ArrayCopierImpl {
private static final int TYPE_SIZE = 8;
private long[] data;
public Int64ArrayCopierImpl(long[] data) {
this.data = data;
}
public void fillArray(BaseArrayTransferService arrayTransferService) {
Int64ArrayTransferService Int64ArrayTransferService = Int64ArrayTransferServiceHelper.narrow(arrayTransferService);
int arraySize = data.length;
int maxBufferSizeBytes = MAX_TRANSFER_SIZE_BYTES;
int maxNumberOfElements = maxBufferSizeBytes/TYPE_SIZE;
// Allocating buffer with max size
long[] buffer = new long[maxNumberOfElements];
Int64ArrayTransferService.setNumberOfElements(arraySize);
int index = 0;
int bufferSize;
while (index < arraySize) {
// determine buffer size
if (index + maxNumberOfElements < arraySize) {
bufferSize = maxNumberOfElements;
} else {
bufferSize = arraySize - index;
}
// copy data
for (int i = 0 ; i < bufferSize; i++) {
buffer[i] = data[index + i];
}
// send buffer
Int64ArrayTransferService.appendBuffer(bufferSize, buffer);
index = index + bufferSize;
}
}
}
\ No newline at end of file