The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

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

Removed useless remote console.

parent 019f69b9
......@@ -295,16 +295,6 @@
<arg line="${idlFlags} ${idlCommonDir}/DataChangeSubscriber.idl" />
</exec>
<echo message="Generating RemoteConsoleProxy.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/RemoteConsoleProxy.idl" />
</exec>
<echo message="Generating RemoteConsoleListener.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/RemoteConsoleListener.idl" />
</exec>
<echo message="Generating LogSubscriber.java" />
<exec executable="idl">
<arg line="${idlFlags} ${idlCommonDir}/LogSubscriber.idl" />
......
/*
* 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.console;
public class CommandProcessorRemoteConsole extends RemoteConsole {
public CommandProcessorRemoteConsole() {
this.communicator = new RemoteConsoleCommunicator("CommandProcessor", "commandProcessorRemoteConsole", this);
}
}
\ 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.console;
public class CoreRemoteConsole extends RemoteConsole {
public CoreRemoteConsole() {
this.communicator = new RemoteConsoleCommunicator("Core", "coreRemoteConsole", this);
}
}
\ 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.console;
public class DataProviderRemoteConsole extends RemoteConsole {
public DataProviderRemoteConsole() {
this.communicator = new RemoteConsoleCommunicator("DataProvider", "dataProviderRemoteConsole", this);
}
}
\ 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.console;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
public class RemoteConsole {
private String serverId = "real";
protected RemoteConsoleCommunicator communicator;
public void up(String serverId) {
communicator.up(serverId);
}
public void down() {
communicator.down();
}
public boolean isOk() {
return communicator.isOk();
}
public void stop() {
communicator.stop();
}
public void execute(String command) {
communicator.execute(command);
}
public void quit() {
communicator.quit();
}
public void error(String errorMessage) {
DataNotificationClient.getInstance().errorOccurred(serverId, errorMessage);
}
public void output(String outputMessage) {
}
public void startup(String startupMessage) {
}
public void shutdown(String shutdownMessage) {
}
public void setServerId(String serverId) {
this.serverId = serverId;
}
}
\ 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.console;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.omg.PortableServer.POAPackage.ObjectNotActive;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongAdapter;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import fr.ill.ics.nomadserver.common.RemoteConsoleListener;
import fr.ill.ics.nomadserver.common.RemoteConsoleListenerHelper;
import fr.ill.ics.nomadserver.common.RemoteConsoleProxy;
import fr.ill.ics.nomadserver.common.RemoteConsoleProxyHelper;
import fr.ill.ics.nscclient.corbabase.CorbaNamingService;
import fr.ill.ics.nscclient.corbabase.CorbaNamingService.CORBAResolveFailureException;
import fr.ill.ics.nscclient.corbabase.CorbaORB;
public class RemoteConsoleCommunicator {
private static final Logger LOGGER = Logger.getLogger(RemoteConsoleCommunicator.class.getName());
private String serverContextName;
private String remoteConsoleProxyName;
private RemoteConsole remoteConsole;
private RemoteConsoleProxy proxy;
private boolean isOk = false;
private RemoteConsoleListenerImpl remoteConsoleListenerImpl;
public RemoteConsoleCommunicator(String serverContextName, String remoteConsoleProxyName, RemoteConsole remoteConsole) {
this.serverContextName = serverContextName;
this.remoteConsoleProxyName = remoteConsoleProxyName;
this.remoteConsole = remoteConsole;
}
public void up(String serverId) {
try {
String contextName = "NomadServer";
if (!serverId.equals("real")) {
contextName += serverId;
}
org.omg.CORBA.Object remoteConsoleObject = CorbaNamingService.getInstance().resolveObject(contextName, serverContextName, remoteConsoleProxyName);
proxy = RemoteConsoleProxyHelper.narrow(remoteConsoleObject);
// create output listener
remoteConsoleListenerImpl = new RemoteConsoleListenerImpl(remoteConsole);
remoteConsole.setServerId(serverId);
org.omg.CORBA.Object o = CorbaORB.getInstance().getPOA().servant_to_reference(remoteConsoleListenerImpl);
RemoteConsoleListener remoteConsoleListener = RemoteConsoleListenerHelper.narrow(o);
proxy.addRemoteConsoleListener(remoteConsoleListener);
remoteConsoleListenerImpl.setByteID(CorbaORB.getInstance().getPOA().reference_to_id(o));
isOk = true;
} catch (CORBAResolveFailureException e) {
LOGGER.log(Level.SEVERE, "Unable to obtain " + remoteConsoleProxyName + " corba object");
} catch (WrongPolicy e) {
LOGGER.log(Level.SEVERE, "Unable to create RemoteConsoleListener in connection with server (WrongPolicy)");
} catch (WrongAdapter e) {
LOGGER.log(Level.SEVERE, "Unable to create RemoteConsoleListener in connection with server (WrongAdapter)");
} catch (ServantNotActive e) {
LOGGER.log(Level.SEVERE, "Unable to create RemoteConsoleListener in connection with server (ServantNotActive)");
}
}
public void down() {
proxy = null;
if (remoteConsoleListenerImpl != null) {
try {
CorbaORB.getInstance().getPOA().deactivate_object(remoteConsoleListenerImpl.getCorbaID());
remoteConsoleListenerImpl = null;
} catch (WrongPolicy e) {
e.printStackTrace();
} catch (ObjectNotActive e) {
e.printStackTrace();
}
isOk = false;
}
}
public boolean isOk() {
return isOk;
}
public void stop() {
if (proxy != null) {
try {
proxy.removeRemoteConsoleListener(remoteConsoleListenerImpl.getID());
} catch (Exception e) {
}
}
}
public void execute(String command) {
if (isOk) {
proxy.execute(command);
}
}
public void quit() {
if (isOk) {
proxy.removeRemoteConsoleListener(remoteConsoleListenerImpl.getID());
proxy.quit();
isOk = false;
}
}
}
\ 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.console;
import fr.ill.ics.nomadserver.common.RemoteConsoleListenerPOA;
import fr.ill.ics.nomadserver.common.RemoteConsoleListenerPackage.OutputType;
public class RemoteConsoleListenerImpl extends RemoteConsoleListenerPOA {
private int ID;
private byte[] corbaID;
private RemoteConsole remoteConsole;
public RemoteConsoleListenerImpl(RemoteConsole remoteConsole) {
this.remoteConsole = remoteConsole;
}
public void output(String outputMessage, OutputType type) {
// switching type
if (type == OutputType.NORMAL) {
remoteConsole.output(outputMessage);
} else if (type == OutputType.ERROR) {
remoteConsole.error(outputMessage);
} else if (type == OutputType.STARTUP) {
remoteConsole.startup(outputMessage);
} else if (type == OutputType.SHUTDOWN) {
remoteConsole.shutdown(outputMessage);
}
}
public void setID(int listenerID) {
this.ID = listenerID;
}
public int getID() {
return ID;
}
public void setByteID(byte[] corbaID) {
this.corbaID = corbaID;
}
public byte[] getCorbaID() {
return corbaID;
}
}
\ 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.console;
public interface RemoteConsoleOutputRouter {
void output(String outputMessage);
void error(String errorMessage);
void startup(String startupMessage);
void shutdown(String shutdownMessage);
}
\ No newline at end of file
......@@ -34,9 +34,6 @@ import fr.ill.ics.nscclient.command.GenericCommandBoxAccessorProxy;
import fr.ill.ics.nscclient.command.ScanCommandBoxAccessorProxy;
import fr.ill.ics.nscclient.commandline.CommandLineProxyImpl;
import fr.ill.ics.nscclient.condition.ConditionManagerProxy;
import fr.ill.ics.nscclient.console.CommandProcessorRemoteConsole;
import fr.ill.ics.nscclient.console.CoreRemoteConsole;
import fr.ill.ics.nscclient.console.DataProviderRemoteConsole;
import fr.ill.ics.nscclient.dataprovider.DataAccessor;
import fr.ill.ics.nscclient.log.LogSubcriberImpl;
import fr.ill.ics.nscclient.notification.commandzone.ServerCommandZoneEventManager;
......@@ -51,9 +48,6 @@ public class ServerSessionManager {
private String serverId;
private CorbaSessionGateway currentSession;
private DataProviderRemoteConsole dataProviderRemoteConsole;
private CommandProcessorRemoteConsole commandProcessorRemoteConsole;
private CoreRemoteConsole coreRemoteConsole;
public class ConnectionFailure extends Exception {};
......@@ -88,13 +82,6 @@ public class ServerSessionManager {
CommandLineProxyImpl.getInstance(serverId).init();
LogSubcriberImpl.getInstance(serverId).init();
SurveySubcriberImpl.getInstance(serverId).init();
dataProviderRemoteConsole = new DataProviderRemoteConsole();
dataProviderRemoteConsole.up(serverId);
commandProcessorRemoteConsole = new CommandProcessorRemoteConsole();
commandProcessorRemoteConsole.up(serverId);
coreRemoteConsole = new CoreRemoteConsole();
coreRemoteConsole.up(serverId);
}
public static ServerSessionManager getInstance(String serverId) {
......@@ -166,13 +153,6 @@ public class ServerSessionManager {
LogSubcriberImpl.getInstance(serverId).unsubscribe();
SurveySubcriberImpl.getInstance(serverId).unsubscribe();
dataProviderRemoteConsole.stop();
dataProviderRemoteConsole.down();
commandProcessorRemoteConsole.stop();
commandProcessorRemoteConsole.down();
coreRemoteConsole.stop();
coreRemoteConsole.down();
currentSession.logout();
currentSession = null;
}
......@@ -196,26 +176,6 @@ public class ServerSessionManager {
currentSession.logout();
currentSession = null;
}
if (coreRemoteConsole != null) {
coreRemoteConsole.stop();
coreRemoteConsole.down();
}
if (commandProcessorRemoteConsole != null) {
commandProcessorRemoteConsole.stop();
commandProcessorRemoteConsole.down();
}
if (dataProviderRemoteConsole != null) {
dataProviderRemoteConsole.stop();
if (stop) {
dataProviderRemoteConsole.quit();
} else {
dataProviderRemoteConsole.down();
}
}
}
public CorbaServantManager getServantManager() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment