use of com.ramussoft.net.common.UserFactory in project ramus by Vitaliy-Yakovchuk.
the class LightClient method initAdditionalGuiPlugins.
@Override
protected void initAdditionalGuiPlugins(List<GUIPlugin> list) {
super.initAdditionalGuiPlugins(list);
list.add(new ClientPlugin(userProvider, true));
if (isAdmin(getMe())) {
UserFactory userFactory;
try {
userFactory = (UserFactory) proxyFactory.create(UserFactory.class, URL_USER_FACTORY);
} catch (MalformedURLException e1) {
e1.printStackTrace();
throw new RuntimeException(e1);
}
AdminPanelPlugin adminPanelPlugin = new AdminPanelPlugin(userFactory, e);
list.add(adminPanelPlugin);
}
}
use of com.ramussoft.net.common.UserFactory in project ramus by Vitaliy-Yakovchuk.
the class InternetServer method run.
private void run(String[] args) throws IOException {
new File(tmpPath).mkdirs();
engineFactory = new EngineFactory() {
};
final ServerSocket ss = new ServerSocket();
ss.bind(new InetSocketAddress("0.0.0.0", Metadata.INTERNET_PORT));
userFactory = new UserFactoryImpl(engineFactory.getTemplate());
serverAccessRules = new ServerAccessRules(engineFactory.getEngine(), userFactory) {
@Override
protected String getLogin() {
return logins.get(Thread.currentThread());
}
};
Thread acceptionThread = new Thread(new Runnable() {
@Override
public void run() {
System.out.println("Ramus Interner Server ready");
while (true) {
try {
final Thread thread;
final Socket socket = ss.accept();
CheckableUserFactory userFactoryClient = new CheckableUserFactory(userFactory);
IntegrityAccessorSuit suit = new IntegrityAccessorSuit();
suit.addAccessRules(serverAccessRules);
suit.addAccessRules(((IEngineImpl) getEngine().getDeligate()).getAccessor());
final ClientServiceImpl service = new ClientServiceImpl(InternetServer.this, userFactory, userFactoryClient);
SuperInvoker invoker = new SuperInvoker(new Object[] { service, suit, userFactoryClient, service }, new Class[] { ClientService.class, AccessRules.class, UserFactory.class, UserProvider.class });
final TcpServerConnection connection = new TcpServerConnection(socket, new String[] { ClientService.class.getName(), AccessRules.class.getName(), UserFactory.class.getName(), UserProvider.class.getName() }, invoker.createProxy()) {
public void close() throws IOException {
synchronized (servicesLock) {
services.remove(service);
}
service.close();
super.close();
}
};
synchronized (servicesLock) {
services.add(service);
}
thread = new Thread(new Runnable() {
@Override
public void run() {
connection.run();
}
}, "server-client");
service.setConnection(connection);
thread.start();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}, "inet-server-main");
acceptionThread.start();
}
use of com.ramussoft.net.common.UserFactory in project ramus by Vitaliy-Yakovchuk.
the class InternetClient method initAdditionalGuiPlugins.
@Override
protected void initAdditionalGuiPlugins(List<GUIPlugin> plugins) {
super.initAdditionalGuiPlugins(plugins);
plugins.add(new UndoRedoPlugin(e));
plugins.add(new ClientPlugin(userProvider, true));
try {
if ((Boolean) connection.invoke("isAdmin", new Object[] {})) {
UserFactory userFactory;
userFactory = (UserFactory) createDeligate(UserFactory.class);
AdminPanelPlugin adminPanelPlugin = new AdminPanelPlugin(userFactory, e);
plugins.add(adminPanelPlugin);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.ramussoft.net.common.UserFactory in project ramus by Vitaliy-Yakovchuk.
the class TcpLightClient method initAdditionalGuiPlugins.
@Override
protected void initAdditionalGuiPlugins(List<GUIPlugin> list) {
super.initAdditionalGuiPlugins(list);
list.add(new ClientPlugin(userProvider, true));
list.add(new LogPlugin());
try {
if ((Boolean) connection.invoke("canUndoRedo", new Object[] {}))
list.add(new UndoRedoPlugin(e));
if ((Boolean) connection.invoke("isAdmin", new Object[] {})) {
UserFactory userFactory;
userFactory = (UserFactory) createDeligate(UserFactory.class);
AdminPanelPlugin adminPanelPlugin = new AdminPanelPlugin(userFactory, e);
list.add(adminPanelPlugin);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations