made first demo almost fully working
This commit is contained in:
parent
2a0d992642
commit
01b3b5cc54
104 changed files with 3259 additions and 2181 deletions
|
|
@ -28,6 +28,11 @@
|
|||
<artifactId>vasc-core-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
|
|
|
|||
|
|
@ -27,27 +27,10 @@ import java.awt.Dimension;
|
|||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
|
|
@ -60,32 +43,22 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
|||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
import net.forwardfire.vasc.annotations.VascModelReference;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendController;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryConfigControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceRemoteBackend;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascController;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
|
|
@ -96,199 +69,23 @@ import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
|||
public class JMainPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
//private VascControllerService vascManager = null;
|
||||
private VascController vc = null;
|
||||
private VascMenuController vmc = null;
|
||||
private VascServiceManager vsm = null;
|
||||
private SwingPanelIntegration spi = null;
|
||||
private JTabbedPane tabPane = null;
|
||||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
|
||||
|
||||
public JMainPanel(VascServiceManager vsm,VascMenuController vmc) {
|
||||
//this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
this.vsm = vsm;
|
||||
this.vmc = vmc;
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
|
||||
vc = createVascController(vsm);
|
||||
|
||||
//vascManager.addVascServiceListener(this);
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
|
||||
class RemoteVascBackend implements VascBackend {
|
||||
|
||||
private String backendId = null;
|
||||
private VascServiceManager vascManager = null;
|
||||
setLayout(new BorderLayout());
|
||||
add(createTreeSplit(), BorderLayout.CENTER);
|
||||
|
||||
public RemoteVascBackend(String backendId,VascServiceManager vascManager) {
|
||||
this.backendId=backendId;
|
||||
this.vascManager=vascManager;
|
||||
}
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
field = ((VascEntryFieldLocal)field).clone(); // RM...
|
||||
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntryLocal clone = null;
|
||||
try {
|
||||
clone = ((VascEntryLocal)vascEntry).clone();
|
||||
clone.setVascFrontendController(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// we cant change id
|
||||
}
|
||||
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
vc = createVascController(vsm);
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -301,7 +98,8 @@ public class JMainPanel extends JPanel {
|
|||
|
||||
// get local jvm plugging controller
|
||||
VascController c = DefaultVascFactory.getDefaultVascController();
|
||||
|
||||
|
||||
((VascEntryConfigControllerLocal)c.getVascEntryConfigController()).setResourceBundle(RootApplicationBundle.class.getName());
|
||||
/*
|
||||
DefaultVascEntryController con = new DefaultVascEntryController() {
|
||||
public VascEntry getVascEntryById(String id) {
|
||||
|
|
@ -323,7 +121,7 @@ public class JMainPanel extends JPanel {
|
|||
for (String id:entryIds) {
|
||||
VascEntryLocal ve = (VascEntryLocal)vascManager.getVascEntry(id);
|
||||
String backendId = ve.getBackendId();
|
||||
VascBackend vb = new RemoteVascBackend(backendId,vascManager);
|
||||
VascBackend vb = new VascServiceRemoteBackend(vascManager,backendId);
|
||||
|
||||
/*
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
|
|
@ -360,32 +158,18 @@ public class JMainPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private JSplitPane createBottomSplit() {
|
||||
JSplitPane sp0 = createTreeSplit();
|
||||
JPanel sp1 = new JPanel();//JConsolePanel();
|
||||
bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sp0,sp1);
|
||||
bottomSplitPane.setOneTouchExpandable(true);
|
||||
bottomSplitPane.setResizeWeight(0.2);
|
||||
bottomSplitPane.setDividerLocation(700);
|
||||
sp0.setMinimumSize(new Dimension(400, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 150));
|
||||
return bottomSplitPane;
|
||||
}
|
||||
|
||||
private JSplitPane createTreeSplit() {
|
||||
JScrollPane sp0 = createTreePane();
|
||||
JScrollPane sp1 = createContentPane();
|
||||
treeSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp0,sp1);
|
||||
treeSplitPane.setOneTouchExpandable(true);
|
||||
treeSplitPane.setResizeWeight(0.7);
|
||||
treeSplitPane.setDividerLocation(200);
|
||||
treeSplitPane.setResizeWeight(0.2);
|
||||
treeSplitPane.setDividerLocation(170);
|
||||
sp0.setMinimumSize(new Dimension(200, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 400));
|
||||
return treeSplitPane;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class VascTreeModel extends DefaultTreeModel {
|
||||
public VascTreeModel(TreeNode root) {
|
||||
super(root);
|
||||
|
|
@ -450,9 +234,9 @@ public class JMainPanel extends JPanel {
|
|||
JScrollPane p = createJScrollPane(contentPane);
|
||||
|
||||
tabPane = new JTabbedPane();
|
||||
spi = new SwingPanelTabbed(tabPane);
|
||||
contentPane.add(tabPane);
|
||||
|
||||
spi = new SwingPanelTabbed(tabPane);
|
||||
contentPane.add(tabPane);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
@ -500,9 +284,9 @@ public class JMainPanel extends JPanel {
|
|||
List<VascMenuGroup> groups = vmc.getFilteredMenuGroup();
|
||||
for (VascMenuGroup group:groups) {
|
||||
|
||||
DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.GROUP,group.getTitle()));
|
||||
DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.GROUP,VascDemoSwingClient.getInstance().i18n(group.getTitleKey())));
|
||||
for (VascMenu vm:group.getMenus()) {
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,vm.getVascEntryId()));
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,VascDemoSwingClient.getInstance().i18n(vm.getTitleKey())));
|
||||
groupNode.add(entryNode);
|
||||
}
|
||||
root.add(groupNode);
|
||||
|
|
|
|||
|
|
@ -24,22 +24,14 @@ package net.forwardfire.vasc.demo.client.swing;
|
|||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
|
||||
|
||||
/**
|
||||
* JMainPanelMenuBar Adds all menu bar items.
|
||||
|
|
@ -50,85 +42,73 @@ import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
|||
public class JMainPanelMenuBar extends JMenuBar implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -2828428804621352725L;
|
||||
private VascMenuController vmc = null;
|
||||
private JMainPanel mainPanel = null;
|
||||
private List<JMenu> vascMenus = null;
|
||||
//private List<JMenu> vascMenus = null;
|
||||
private JMenu clientFileMenu = null;
|
||||
private JMenu clientTabMenu = null;
|
||||
|
||||
public JMainPanelMenuBar(VascMenuController vmc,JMainPanel mainPanel) {
|
||||
this.vmc=vmc;
|
||||
this.mainPanel=mainPanel;
|
||||
|
||||
clientFileMenu = new JMenu("File");
|
||||
add(clientFileMenu);
|
||||
|
||||
JMenuItem logoutItem = new JMenuItem("Logout");
|
||||
logoutItem.addActionListener(new ActionListener() {
|
||||
JMenuItem logoutItem = new JMenuItem("Logout");
|
||||
logoutItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
/*
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
*/
|
||||
VascDemoSwingClient.getInstance().logout();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
clientFileMenu.add(logoutItem);
|
||||
clientFileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
});
|
||||
clientFileMenu.add(logoutItem);
|
||||
clientFileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascDemoSwingClient.getInstance().exit();
|
||||
}
|
||||
});
|
||||
clientFileMenu.add(exitItem);
|
||||
|
||||
});
|
||||
clientFileMenu.add(exitItem);
|
||||
|
||||
/*
|
||||
List<VascMenuGroup> groups = vmc.getFilteredMenuGroup();
|
||||
for (VascMenuGroup group:groups) {
|
||||
JMenu menu = new JMenu(group.getTitle());
|
||||
JMenu menu = new JMenu(group.getTitleKey());
|
||||
for (VascMenu vm:group.getMenus()) {
|
||||
JMenuItem item = new JMenuItem(vm.getTitle());
|
||||
JMenuItem item = new JMenuItem(vm.getTitleKey());
|
||||
item.putClientProperty("vascEntryId", vm.getVascEntryId());
|
||||
item.addActionListener(this);
|
||||
menu.add(item);
|
||||
}
|
||||
add(menu);
|
||||
}
|
||||
*/
|
||||
|
||||
clientTabMenu = new JMenu("Tabs");
|
||||
add(clientTabMenu);
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = getTabPane();
|
||||
if (tabPane.getSelectedIndex()>=0) {
|
||||
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
clientTabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
});
|
||||
clientTabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
JTabbedPane tabPane = getTabPane();
|
||||
for (int i=tabPane.getTabCount();i>0;i--) {
|
||||
tabPane.removeTabAt(i-1); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
});
|
||||
clientTabMenu.add(itemAll);
|
||||
});
|
||||
clientTabMenu.add(itemAll);
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
|
|
@ -148,66 +128,4 @@ public class JMainPanelMenuBar extends JMenuBar implements ActionListener {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private void createMenuItems() {
|
||||
JMenuItem openXmlItem = new JMenuItem("Import Xml");
|
||||
openXmlItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
fileMenu.add(openXmlItem);
|
||||
//JMenuItem closeXmlItem = new JMenuItem("Close");
|
||||
//fileMenu.add(closeXmlItem);
|
||||
fileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//JApplication.getInstance().exit();
|
||||
}
|
||||
});
|
||||
fileMenu.add(exitItem);
|
||||
|
||||
JMenuItem connectVascItem = new JMenuItem("Add Vasc");
|
||||
connectVascItem.setEnabled(false);
|
||||
connectVascItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectVascItem);
|
||||
|
||||
JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
|
||||
connectLdapItem.setEnabled(false);
|
||||
vascMenu.add(connectLdapItem);
|
||||
vascMenu.addSeparator();
|
||||
|
||||
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem removeEntryItem = new JMenuItem("Remove entry");
|
||||
removeEntryItem.setEnabled(false);
|
||||
removeEntryItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeEntryItem);
|
||||
|
||||
|
||||
|
||||
|
||||
tabMenu.add(itemAll);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,27 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.client.swing;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -20,63 +33,58 @@ import java.util.logging.Logger;
|
|||
import javax.naming.CommunicationException;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NameClassPair;
|
||||
import javax.naming.NamingException;
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.login.LoginContext;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserController;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
|
||||
/**
|
||||
* VascDemoSwingClient is the main swing remote client.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 10, 2012
|
||||
*/
|
||||
public class VascDemoSwingClient extends SingleFrameApplication {
|
||||
|
||||
private static VascDemoSwingClient instance = null;
|
||||
static protected Context context = null;
|
||||
static protected LoginContext loginContext = null;
|
||||
private Logger logger = null;
|
||||
|
||||
static public void main(String[] args) {
|
||||
/*
|
||||
instance = new VascDemoSwingClient();
|
||||
instance.initialize(args);
|
||||
instance.startup();
|
||||
*/
|
||||
Application.launch(VascDemoSwingClient.class, new String[] {});
|
||||
}
|
||||
|
||||
static public VascDemoSwingClient getInstance() {
|
||||
return (VascDemoSwingClient)SingleFrameApplication.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startup() {
|
||||
|
||||
logger = Logger.getLogger(VascDemoSwingClient.class.getName());
|
||||
createContext();
|
||||
try {
|
||||
setJaasConfig();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
doLogin();
|
||||
|
||||
|
||||
JdniTreePrinter printer = new JdniTreePrinter(false);
|
||||
StringBuffer buf = new StringBuffer();
|
||||
printer.printJNDITree(context, "", buf);
|
||||
System.out.println(buf);
|
||||
|
||||
VascServiceManager vc = null;
|
||||
LoginUserController luc = null;
|
||||
ClientUserController cuc = null;
|
||||
VascMenuController vmc = null;
|
||||
try {
|
||||
vc = (VascServiceManager)context.lookup("vascServiceManagerRemote");
|
||||
System.out.println("ob: "+vc);
|
||||
|
||||
luc = (LoginUserController)context.lookup("loginUserControllerRemote");
|
||||
System.out.println("fll: "+luc.doClientLogin());
|
||||
cuc = (ClientUserController)context.lookup("clientUserControllerRemote");
|
||||
System.out.println("fll: "+cuc.doClientLogin());
|
||||
|
||||
// i18n fixme !!
|
||||
RootApplicationBundle bundle = (RootApplicationBundle)ResourceBundle.getBundle(RootApplicationBundle.class.getName());
|
||||
bundle.addBundleData(cuc.getResourceBundle(bundle.getLocale()));
|
||||
|
||||
vmc = (VascMenuController)context.lookup("vascMenuControllerRemote");
|
||||
} catch (Exception e) {
|
||||
|
|
@ -86,126 +94,48 @@ public class VascDemoSwingClient extends SingleFrameApplication {
|
|||
JMainPanel mainPanel = new JMainPanel(vc,vmc);
|
||||
SingleFrameApplication a = (VascDemoSwingClient)getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
|
||||
FrameView mainView = a.getMainView();
|
||||
|
||||
mainView.getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
mainView.setComponent(mainPanel);
|
||||
mainView.setMenuBar(new JMainPanelMenuBar(vmc,mainPanel));
|
||||
mainView.getFrame().setSize(600, 800);
|
||||
mainView.getFrame().setSize(1000, 600);
|
||||
mainView.getFrame().setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created an context to the showplanner server.
|
||||
*/
|
||||
private void createContext() {
|
||||
Properties props = new Properties();
|
||||
String connectUrl = "http://localhost:8899/demo/ejb"; //System.getProperty("javaws.connecturl");
|
||||
logger.info("Connecting to: "+connectUrl);
|
||||
props.put(Context.PROVIDER_URL, connectUrl );
|
||||
props.put("openejb.authentication.realmName", "vasc-auth-server");
|
||||
props.put(Context.SECURITY_PRINCIPAL,"admin");
|
||||
props.put(Context.SECURITY_CREDENTIALS,"admin123");
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
|
||||
public void logout() {
|
||||
SingleFrameApplication a = (VascDemoSwingClient)getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
|
||||
FrameView mainView = a.getMainView();
|
||||
mainView.getFrame().setVisible(false);
|
||||
|
||||
try {
|
||||
context = new InitialContext(props);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//logger.log(Level.WARNING,e.getMessage(),e);
|
||||
//ExceptionDialog err = new ExceptionDialog(e,true);
|
||||
//err.showOpenDialog(null,i18n(VascDemoSwingClient.class,"dialogTitle"),i18n(VascDemoSwingClient.class,"dialogContext"));
|
||||
}
|
||||
startup(); // ugly ..
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets our jaas config path
|
||||
*/
|
||||
private void setJaasConfig() throws IOException {
|
||||
|
||||
// tomee
|
||||
String path = System.getProperty("java.security.auth.login.config");
|
||||
if (path == null) {
|
||||
URL url = VascDemoSwingClient.class.getClassLoader().getResource("META-INF/client.login.conf");
|
||||
|
||||
File tempFile = File.createTempFile("cached-", ".jar");
|
||||
tempFile.deleteOnExit();
|
||||
copyFile(url.openConnection().getInputStream(),tempFile);
|
||||
String urlString = "file:"+tempFile.getAbsolutePath();
|
||||
//logger.info("Setting jaas config property to url: "+urlString);
|
||||
System.setProperty("java.security.auth.login.config", urlString);
|
||||
logger.info("Setting jaas config property to url: "+urlString);
|
||||
/*
|
||||
if (resource != null) {
|
||||
path = URLDecoder.decode(resource.getFile());
|
||||
System.setProperty("java.security.auth.login.config", path);
|
||||
|
||||
} else {
|
||||
logger.warning("Could not find client.login.conf");
|
||||
}*/
|
||||
}
|
||||
|
||||
/* jboss
|
||||
URL url = Thread.currentThread().getContextClassLoader().getResource("META-INF/jaas.config");
|
||||
String urlString = url.toExternalForm();
|
||||
|
||||
// jdk1.6 update10 has different classloader, so just copy for the moment..... ..
|
||||
if (urlString.startsWith("jar:")) {
|
||||
File tempFile = File.createTempFile("cached-", ".jar");
|
||||
tempFile.deleteOnExit();
|
||||
copyFile(url.openConnection().getInputStream(),tempFile);
|
||||
urlString = "file:"+tempFile.getAbsolutePath();
|
||||
}
|
||||
|
||||
//logger.info("Setting jaas config property to url: "+urlString);
|
||||
System.setProperty("java.security.auth.login.config", urlString);
|
||||
*/
|
||||
}
|
||||
|
||||
private void copyFile(InputStream in, File out) throws IOException {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(1024*4);
|
||||
byte[] bufferArray = buffer.array();
|
||||
FileChannel outputChannel = new FileOutputStream(out).getChannel();
|
||||
while (true) {
|
||||
buffer.clear();
|
||||
int lim = in.read(bufferArray);
|
||||
if (lim < 0) {
|
||||
break; // could not read anymore
|
||||
}
|
||||
buffer.flip();
|
||||
buffer.limit(lim);
|
||||
while (buffer.hasRemaining()) {
|
||||
outputChannel.write(buffer);
|
||||
}
|
||||
}
|
||||
outputChannel.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do an login on the server
|
||||
*/
|
||||
private void doLogin() {
|
||||
VascDemoUserLoginDialog loginHandler = new VascDemoUserLoginDialog();
|
||||
try {
|
||||
loginContext = new LoginContext("vasc-auth-client", loginHandler);
|
||||
loginContext.login();
|
||||
loginHandler.setConnectUrl("http://localhost:8899/demo");
|
||||
/*
|
||||
try {
|
||||
loginContext = new LoginContext("vasc-auth-client", loginHandler);
|
||||
loginContext.login();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, i18n(this,"dialogNoLoginContext"),i18n(this,"dialogTitle"), JOptionPane.WARNING_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
try {
|
||||
// Subject subject = loginContext.getSubject();
|
||||
|
||||
if(doLoginTest()) {
|
||||
loginHandler.handle();
|
||||
if(doLoginContext(loginHandler)) {
|
||||
return;
|
||||
}
|
||||
loginContext.login();
|
||||
if(doLoginTest()) {
|
||||
loginHandler.handle();
|
||||
if(doLoginContext(loginHandler)) {
|
||||
return;
|
||||
}
|
||||
loginContext.login();
|
||||
if(doLoginTest()) {
|
||||
loginHandler.handle();
|
||||
if(doLoginContext(loginHandler)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -234,25 +164,45 @@ public class VascDemoSwingClient extends SingleFrameApplication {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if we have 'login' role on server.
|
||||
* Create naming context and check if we have 'login' role on server.
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private boolean doLoginTest() throws Exception {
|
||||
private boolean doLoginContext(VascDemoUserLoginDialog loginHandler) throws Exception {
|
||||
Properties props = new Properties();
|
||||
String connectUrl = loginHandler.getConnectUrl()+"/ejb";
|
||||
logger.info("Connecting to: "+connectUrl);
|
||||
props.put(Context.PROVIDER_URL, connectUrl );
|
||||
props.put("openejb.authentication.realmName", "vasc-auth-server");
|
||||
props.put(Context.SECURITY_PRINCIPAL,loginHandler.getUsername());
|
||||
props.put(Context.SECURITY_CREDENTIALS,loginHandler.getPassword());
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
|
||||
try {
|
||||
LoginUserController loginManager = (LoginUserController)context.lookup("loginUserControllerRemote");
|
||||
loginManager.doClientLogin();
|
||||
return true;
|
||||
context = new InitialContext(props);
|
||||
ClientUserController loginManager = (ClientUserController)context.lookup("clientUserControllerRemote");
|
||||
loginManager.doClientLogin();
|
||||
return true;
|
||||
} catch (javax.naming.NameNotFoundException e) {
|
||||
JOptionPane.showMessageDialog(null, "Server is not deployed.\nPlease wait a couple of minuts and try again.");
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(null, "Server error: "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(null, "Server error: "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String i18n(Object obj,String key,Object...params) {
|
||||
if(obj==null) { throw new NullPointerException("Can't get key of null obj"); }
|
||||
if (key==null) { throw new NullPointerException("key may not be null"); }
|
||||
if(obj instanceof Class) {
|
||||
key=((Class<?>)obj).getName()+"."+key;
|
||||
} else {
|
||||
key=obj.getClass().getName()+"."+key;
|
||||
}
|
||||
return i18n(key,params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some simple hardcoded i18n function here
|
||||
*
|
||||
|
|
@ -260,102 +210,16 @@ public class VascDemoSwingClient extends SingleFrameApplication {
|
|||
* @param params
|
||||
* @return
|
||||
*/
|
||||
static protected String i18n(Object obj,String key,Object...params) {
|
||||
if(obj==null) { throw new NullPointerException("Can't get key of null obj"); }
|
||||
if (key==null) { throw new NullPointerException("key may not be null"); }
|
||||
if(obj instanceof Class) {
|
||||
key=((Class<?>)obj).getName()+"."+key;
|
||||
} else {
|
||||
key=obj.getClass().getName()+"."+key;
|
||||
}
|
||||
return key;
|
||||
/*
|
||||
public String i18n(String key,Object...params) {
|
||||
try {
|
||||
String text = ResourceBundle.getBundle("resources.i18n.root").getString(key);
|
||||
String text = ResourceBundle.getBundle(RootApplicationBundle.class.getName()).getString(key);
|
||||
if (params != null) {
|
||||
MessageFormat mf = new MessageFormat(text);
|
||||
text = mf.format(params, new StringBuffer(), null).toString();
|
||||
}
|
||||
return text;
|
||||
} catch(MissingResourceException e){
|
||||
return "MISSING: '"+key+"'";
|
||||
return key;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
class JdniTreePrinter {
|
||||
|
||||
boolean printXml = true;
|
||||
|
||||
public JdniTreePrinter(boolean printXml) {
|
||||
this.printXml=printXml;
|
||||
}
|
||||
|
||||
public void printJNDITree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
if (printXml) {
|
||||
buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
buf.append("<NamingRoot name=\""+ct+"\">\n");
|
||||
}
|
||||
printTree(context,ct,buf);
|
||||
if (printXml) {
|
||||
buf.append("</NamingRoot>\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void printTree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
try {
|
||||
printNE(context,context.list(ct), ct,buf);
|
||||
} catch (NamingException e) {
|
||||
//ignore leaf node exception
|
||||
}
|
||||
}
|
||||
|
||||
private void printNE(javax.naming.Context context,javax.naming.NamingEnumeration<?> ne, String parentctx,StringBuffer buf) throws NamingException {
|
||||
if (ne==null) {
|
||||
return;
|
||||
}
|
||||
while (ne.hasMoreElements()) {
|
||||
NameClassPair next = (NameClassPair) ne.nextElement();
|
||||
if (printXml) {
|
||||
printIndent(buf);
|
||||
buf.append("<NamingRoot name=\""+next.getName()+"\" className=\""+next.getClassName()+"\">\n");
|
||||
increaseIndent();
|
||||
printTree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
|
||||
printIndent(buf);
|
||||
buf.append("</NamingRoot>\n");
|
||||
} else {
|
||||
printEntry(next,buf);
|
||||
increaseIndent();
|
||||
printTree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printEntry(javax.naming.NameClassPair next,StringBuffer buf) {
|
||||
printIndent(buf);
|
||||
buf.append("-->");
|
||||
buf.append(next);
|
||||
buf.append("\n");
|
||||
}
|
||||
|
||||
|
||||
private int indentLevel = 0;
|
||||
|
||||
private void increaseIndent() {
|
||||
indentLevel += 4;
|
||||
}
|
||||
|
||||
private void decreaseIndent() {
|
||||
indentLevel -= 4;
|
||||
}
|
||||
|
||||
private void printIndent(StringBuffer buf) {
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
buf.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,27 @@
|
|||
/*
|
||||
* @(#)DialogCallbackHandler.java 1.9 03/12/19
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.client.swing;
|
||||
|
||||
import javax.security.auth.callback.Callback;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
import javax.security.auth.callback.ConfirmationCallback;
|
||||
import javax.security.auth.callback.NameCallback;
|
||||
import javax.security.auth.callback.PasswordCallback;
|
||||
import javax.security.auth.callback.TextOutputCallback;
|
||||
import javax.security.auth.callback.UnsupportedCallbackException;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
|
|
@ -59,14 +66,15 @@ import javax.swing.JTextField;
|
|||
*
|
||||
* @see javax.security.auth.callback
|
||||
*/
|
||||
public class VascDemoUserLoginDialog implements CallbackHandler {
|
||||
public class VascDemoUserLoginDialog {
|
||||
|
||||
/* The parent window, or null if using the default parent */
|
||||
private Component parentComponent;
|
||||
private static final int JPasswordFieldLen = 8;
|
||||
private int loginTry = 0;
|
||||
private String userName = null;
|
||||
|
||||
private String connectUrl = null;
|
||||
private String username = null;
|
||||
private String password = null;
|
||||
|
||||
/**
|
||||
* Creates a callback dialog with the default parent window.
|
||||
*/
|
||||
|
|
@ -93,15 +101,9 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handles the specified set of callbacks.
|
||||
*
|
||||
* @param callbacks
|
||||
* the callbacks to handle
|
||||
* @throws UnsupportedCallbackException
|
||||
* if the callback is not an instance of NameCallback or
|
||||
* PasswordCallback
|
||||
* Handles the login dialog
|
||||
*/
|
||||
public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
|
||||
public void handle() {
|
||||
this.loginTry++;
|
||||
/* Collect messages to display in the dialog */
|
||||
final JPanel loginDesign = new JPanel();
|
||||
|
|
@ -110,32 +112,28 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
final JPanel logoPanel = new JPanel() {
|
||||
private static final long serialVersionUID = 10l;
|
||||
protected void paintComponent(Graphics g) {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
// for antialiasing geometric shapes
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// for antialiasing text
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
// to go for quality over speed
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
|
||||
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
|
||||
|
||||
// Paint the default look of the panel.
|
||||
super.paintComponent(g2d);
|
||||
super.paintComponent(g2d);
|
||||
|
||||
int offsetX = 0; // for windows systems
|
||||
int offsetX = 0; // for windows systems
|
||||
boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1;
|
||||
if (isWindows) {
|
||||
offsetX += 25;
|
||||
}
|
||||
|
||||
g2d.setColor(Color.BLACK);
|
||||
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.fillRect(0,0,getWidth(),getHeight());
|
||||
g2d.setColor(new Color(238,212,1));
|
||||
|
||||
//int w = (getWidth()/2)-(logoImage.getWidth(null)/2);
|
||||
//int h = (getHeight()/2)-(logoImage.getHeight(null)/2);
|
||||
//g2d.drawImage(logoImage, w, h, this);
|
||||
}
|
||||
//int w = (getWidth()/2)-(logoImage.getWidth(null)/2);
|
||||
//int h = (getHeight()/2)-(logoImage.getHeight(null)/2);
|
||||
//g2d.drawImage(logoImage, w, h, this);
|
||||
}
|
||||
};
|
||||
logoPanel.setPreferredSize(new Dimension(200, 170));
|
||||
logoPanel.setBorder(BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
|
||||
|
|
@ -148,92 +146,64 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
loginDesign.add(namePanel);
|
||||
loginDesign.add(Box.createVerticalStrut(5));
|
||||
|
||||
final GridLayout messagesLayout = new GridLayout(2,2);
|
||||
final GridLayout messagesLayout = new GridLayout(3,2);
|
||||
final JPanel messages = new JPanel();
|
||||
messages.setLayout(messagesLayout);
|
||||
|
||||
/* Collection actions to perform if the user clicks OK */
|
||||
final List<Action> okActions = new ArrayList<Action>(2);
|
||||
ConfirmationInfo confirmation = new ConfirmationInfo();
|
||||
|
||||
// Add server field
|
||||
JLabel serverName = new JLabel("Server:");
|
||||
final JTextField serverField = new JTextField(getConnectUrl());
|
||||
messages.add(serverName);
|
||||
messages.add(serverField);
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
connectUrl = serverField.getText();
|
||||
}
|
||||
});
|
||||
|
||||
// hackje for focus
|
||||
final JTextField name = new JTextField();
|
||||
confirmation.initialValue=name;
|
||||
final JPasswordField pass = new JPasswordField(JPasswordFieldLen);
|
||||
|
||||
for (int i = 0; i < callbacks.length; i++) {
|
||||
if (callbacks[i] instanceof TextOutputCallback) {
|
||||
TextOutputCallback tc = (TextOutputCallback) callbacks[i];
|
||||
|
||||
switch (tc.getMessageType()) {
|
||||
case TextOutputCallback.INFORMATION:
|
||||
confirmation.messageType = JOptionPane.INFORMATION_MESSAGE;
|
||||
break;
|
||||
case TextOutputCallback.WARNING:
|
||||
confirmation.messageType = JOptionPane.WARNING_MESSAGE;
|
||||
break;
|
||||
case TextOutputCallback.ERROR:
|
||||
confirmation.messageType = JOptionPane.ERROR_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized message type");
|
||||
}
|
||||
messages.add(new JLabel(tc.getMessage()));
|
||||
|
||||
} else if (callbacks[i] instanceof NameCallback) {
|
||||
final NameCallback nc = (NameCallback) callbacks[i];
|
||||
|
||||
JLabel prompt = new JLabel(nc.getPrompt());
|
||||
String defaultName = nc.getDefaultName();
|
||||
|
||||
// if (check some property)
|
||||
defaultName = "";
|
||||
if (defaultName != null) {
|
||||
name.setText(defaultName);
|
||||
}
|
||||
// default to last user name
|
||||
if (userName !=null ) {
|
||||
name.setText(userName);
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(name);
|
||||
|
||||
/* Store the name back into the callback if OK */
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
nc.setName(name.getText());
|
||||
}
|
||||
});
|
||||
|
||||
} else if (callbacks[i] instanceof PasswordCallback) {
|
||||
final PasswordCallback pc = (PasswordCallback) callbacks[i];
|
||||
|
||||
JLabel prompt = new JLabel(pc.getPrompt());
|
||||
|
||||
final JPasswordField password = new JPasswordField(JPasswordFieldLen);
|
||||
if (!pc.isEchoOn()) {
|
||||
password.setEchoChar('*');
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(password);
|
||||
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
pc.setPassword(password.getPassword());
|
||||
}
|
||||
});
|
||||
|
||||
} else if (callbacks[i] instanceof ConfirmationCallback) {
|
||||
ConfirmationCallback cc = (ConfirmationCallback) callbacks[i];
|
||||
|
||||
confirmation.setCallback(cc);
|
||||
if (cc.getPrompt() != null) {
|
||||
messages.add(new JLabel(cc.getPrompt()));
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
|
||||
}
|
||||
JLabel prompt = new JLabel("Username:");
|
||||
String defaultName = null;
|
||||
|
||||
// if (check some property)
|
||||
defaultName = "";
|
||||
if (defaultName != null) {
|
||||
name.setText(defaultName);
|
||||
}
|
||||
// default to last user name
|
||||
if (username !=null ) {
|
||||
name.setText(username);
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(name);
|
||||
|
||||
/* Store the name back into the callback if OK */
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
username = name.getText();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
prompt = new JLabel("Password:");
|
||||
|
||||
//if (!pc.isEchoOn()) {
|
||||
pass.setEchoChar('*');
|
||||
//}
|
||||
messages.add(prompt);
|
||||
messages.add(pass);
|
||||
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
password = new String(pass.getPassword());
|
||||
}
|
||||
});
|
||||
|
||||
if (this.loginTry>1) {
|
||||
JPanel messagesPanel = new JPanel();
|
||||
|
|
@ -251,25 +221,17 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
loginDesign.add(messagesPanel);
|
||||
/* Display the dialog */
|
||||
|
||||
Object[] options = null;
|
||||
/// JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
|
||||
JOptionPane jop = new JOptionPane(loginDesign, JOptionPane.PLAIN_MESSAGE,confirmation.optionType,null,
|
||||
confirmation.options,confirmation.initialValue);
|
||||
JOptionPane jop = new JOptionPane(loginDesign, JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,null,options,name);
|
||||
|
||||
JDialog dialog = jop.createDialog(parentComponent,"Vasc Demo Login");
|
||||
|
||||
// We alway request focus after the windows gets focus
|
||||
dialog.addWindowFocusListener(new WindowFocusListener() {
|
||||
/**
|
||||
* @see java.awt.event.WindowFocusListener#windowGainedFocus(java.awt.event.WindowEvent)
|
||||
*/
|
||||
public void windowGainedFocus(WindowEvent arg0) {
|
||||
//System.out.println("request focus window focus");
|
||||
name.requestFocus();
|
||||
name.requestFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.event.WindowFocusListener#windowLostFocus(java.awt.event.WindowEvent)
|
||||
*/
|
||||
public void windowLostFocus(WindowEvent arg0) {
|
||||
}
|
||||
});
|
||||
|
|
@ -299,10 +261,7 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
// is null when escaping by window closing
|
||||
result = JOptionPane.CANCEL_OPTION;
|
||||
}
|
||||
|
||||
// copy user name for next try
|
||||
userName = name.getText();
|
||||
|
||||
|
||||
/* Perform the OK actions */
|
||||
if (result == JOptionPane.OK_OPTION || result == JOptionPane.YES_OPTION) {
|
||||
Iterator<Action> iterator = okActions.iterator();
|
||||
|
|
@ -312,97 +271,34 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
} else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.NO_OPTION) {
|
||||
System.exit(1);
|
||||
}
|
||||
confirmation.handleResult(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Provides assistance with translating between JAAS and Swing confirmation
|
||||
* dialogs.
|
||||
* @return the username
|
||||
*/
|
||||
private static class ConfirmationInfo {
|
||||
|
||||
private int[] translations;
|
||||
|
||||
int optionType = JOptionPane.OK_CANCEL_OPTION;
|
||||
Object[] options = null;
|
||||
Object initialValue = null;
|
||||
|
||||
int messageType = JOptionPane.QUESTION_MESSAGE;
|
||||
|
||||
private ConfirmationCallback callback;
|
||||
|
||||
/* Set the confirmation callback handler */
|
||||
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException {
|
||||
this.callback = callback;
|
||||
|
||||
int confirmationOptionType = callback.getOptionType();
|
||||
switch (confirmationOptionType) {
|
||||
case ConfirmationCallback.YES_NO_OPTION:
|
||||
optionType = JOptionPane.YES_NO_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.YES_NO_CANCEL_OPTION:
|
||||
optionType = JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION,
|
||||
ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.OK_CANCEL_OPTION:
|
||||
optionType = JOptionPane.OK_CANCEL_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION,
|
||||
ConfirmationCallback.CANCEL
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.UNSPECIFIED_OPTION:
|
||||
options = callback.getOptions();
|
||||
/*
|
||||
* There's no way to know if the default option means to
|
||||
* cancel the login, but there isn't a better way to guess
|
||||
* this.
|
||||
*/
|
||||
translations = new int[] {
|
||||
JOptionPane.CLOSED_OPTION, callback.getDefaultOption()
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callback, "Unrecognized option type: " + confirmationOptionType);
|
||||
}
|
||||
|
||||
int confirmationMessageType = callback.getMessageType();
|
||||
switch (confirmationMessageType) {
|
||||
case ConfirmationCallback.WARNING:
|
||||
messageType = JOptionPane.WARNING_MESSAGE;
|
||||
break;
|
||||
case ConfirmationCallback.ERROR:
|
||||
messageType = JOptionPane.ERROR_MESSAGE;
|
||||
break;
|
||||
case ConfirmationCallback.INFORMATION:
|
||||
messageType = JOptionPane.INFORMATION_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callback, "Unrecognized message type: " + confirmationMessageType);
|
||||
}
|
||||
}
|
||||
|
||||
/* Process the result returned by the Swing dialog */
|
||||
void handleResult(int result) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < translations.length; i += 2) {
|
||||
if (translations[i] == result) {
|
||||
result = translations[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
callback.setSelectedIndex(result);
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the connectUrl
|
||||
*/
|
||||
public String getConnectUrl() {
|
||||
return connectUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connectUrl the connectUrl to set
|
||||
*/
|
||||
public void setConnectUrl(String connectUrl) {
|
||||
this.connectUrl = connectUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
vasc-auth-client {
|
||||
org.apache.openejb.client.ClientLoginModule required
|
||||
debug=true
|
||||
openejb.server.uri="http://localhost:8899/demo/ejb";
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
config.charset=UTF-8
|
||||
config.bundles=bundle1
|
||||
#,bundle2
|
||||
|
||||
# bundle list to merge and load
|
||||
bundle1.uri=net.forwardfire.vasc.demo.client.swing.resources.VascDemoSwingClient
|
||||
|
||||
#bundle2.uri=data/vasc-bundle.properties
|
||||
#bundle2.type=FILE
|
||||
#bundle2.optional=true
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# Copyright (c) 2011, Willem Cazander
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
# that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
# the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# Application's properties
|
||||
Application.name = Vasc Demo Tech
|
||||
Application.title = VascDemoTech
|
||||
Application.vendor = Willem Cazander
|
||||
Application.homepage = http://vasc.forwardfire.org/
|
||||
Application.vendorId = vasc
|
||||
Application.id = vascdemotech
|
||||
Application.lookAndFeel = com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
|
||||
#Application.icon = images/icon.png
|
||||
|
|
@ -9,11 +9,29 @@
|
|||
<name>vasc-demo-tech-ejb3</name>
|
||||
<description>vasc-demo-tech-ejb3</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -37,9 +37,11 @@ import javax.naming.InitialContext;
|
|||
import javax.naming.NamingException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryAccessType;
|
||||
import net.forwardfire.vasc.core.VascEntryGroup;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroupComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWeb;
|
||||
|
|
@ -54,17 +56,12 @@ import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
|||
public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuControllerRemote {
|
||||
|
||||
private VascMenuWebComparator vascMenuWebComparator = null;
|
||||
private VascMenuGroupComparator vascMenuGroupComparator = null;
|
||||
private VascMenuComparator vascMenuComparator = null;
|
||||
|
||||
@Resource
|
||||
private SessionContext session;
|
||||
|
||||
|
||||
public VascMenuControllerImpl() {
|
||||
vascMenuWebComparator = new VascMenuWebComparator();
|
||||
vascMenuGroupComparator = new VascMenuGroupComparator();
|
||||
vascMenuComparator = new VascMenuComparator();
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> fetchVascMenuWeb() {
|
||||
|
|
@ -104,78 +101,7 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenuGroup> fetchVascMenuGroup() {
|
||||
List<VascMenuGroup> result = new ArrayList<VascMenuGroup>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU_GROUP");
|
||||
ResultSet rs = s.getResultSet();
|
||||
while (rs.next()) {
|
||||
VascMenuGroup menu = new VascMenuGroup();
|
||||
menu.setId(rs.getString(1));
|
||||
menu.setTitle(rs.getString(2));
|
||||
menu.setActive(rs.getBoolean(3));
|
||||
menu.setRoles(rs.getString(4));
|
||||
menu.setMenuOrder(rs.getInt(5));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenu> fetchVascMenu() {
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU");
|
||||
ResultSet rs = s.getResultSet();
|
||||
while (rs.next()) {
|
||||
VascMenu menu = new VascMenu();
|
||||
menu.setId(rs.getInt(1));
|
||||
menu.setVascEntryId(rs.getString(2));
|
||||
menu.setTitle(rs.getString(3));
|
||||
menu.setActive(rs.getBoolean(4));
|
||||
menu.setRoles(rs.getString(5));
|
||||
menu.setMenuOrder(rs.getInt(6));
|
||||
menu.setMenuGroup(rs.getString(7));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private DataSource getDataSource(String name) throws SQLException {
|
||||
try {
|
||||
|
|
@ -210,11 +136,28 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
|||
}
|
||||
|
||||
public List<VascMenuGroup> getFilteredMenuGroup() {
|
||||
List<VascMenuGroup> result = fetchVascMenuGroup();
|
||||
for (VascMenuGroup group:result) {
|
||||
group.setMenus(getFilteredMenu(group.getId()));
|
||||
|
||||
VascController vc = null;
|
||||
try {
|
||||
Context initialContext = new InitialContext();
|
||||
vc = (VascController)initialContext.lookup("openejb:Resource/vasc/server-tech");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Collections.sort(result,vascMenuGroupComparator);
|
||||
|
||||
List<VascMenuGroup> result = new ArrayList<VascMenuGroup>(20);
|
||||
for (String groupdId:vc.getVascEntryController().getVascEntryGroupIds()) {
|
||||
VascEntryGroup veg = vc.getVascEntryController().getVascEntryGroupById(groupdId);
|
||||
if (filterVascMenuRoles(veg.getView(),veg.getRolesView())==false) {
|
||||
continue;
|
||||
}
|
||||
VascMenuGroup group = new VascMenuGroup();
|
||||
group.setId(veg.getId());
|
||||
group.setTitleKey(veg.getName());
|
||||
group.setMenus(getFilteredMenu(group.getId()));
|
||||
result.add(group);
|
||||
}
|
||||
// Collections.sort(result,vascMenuGroupComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -222,13 +165,33 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
|||
if (groupId==null) {
|
||||
throw new NullPointerException("Can't filter on null groupId.");
|
||||
}
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(15);
|
||||
for (VascMenu menu:fetchVascMenu()) {
|
||||
if (groupId.equals(menu.getMenuGroup())) {
|
||||
result.add(menu);
|
||||
}
|
||||
VascController vc = null;
|
||||
try {
|
||||
Context initialContext = new InitialContext();
|
||||
vc = (VascController)initialContext.lookup("openejb:Resource/vasc/server-tech");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Collections.sort(result,vascMenuComparator);
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(15);
|
||||
for (String vascEntryId:vc.getVascEntryController().getVascEntryByGroupId(groupId)) {
|
||||
VascEntry ve = vc.getVascEntryController().getVascEntryById(vascEntryId);
|
||||
if (ve.getAccessType()!=null && (
|
||||
ve.getAccessType()==VascEntryAccessType.ENTRY_LINK |
|
||||
ve.getAccessType()==VascEntryAccessType.ENTRY_LIST
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (filterVascMenuRoles(ve.getView(),ve.getRolesView())==false) {
|
||||
continue;
|
||||
}
|
||||
VascMenu menu = new VascMenu();
|
||||
menu.setVascEntryId(ve.getId());
|
||||
menu.setVascGroupId(ve.getVascGroupId());
|
||||
menu.setTitleKey(ve.getName());
|
||||
result.add(menu);
|
||||
}
|
||||
// Collections.sort(result,vascMenuComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,109 +33,43 @@ import java.io.Serializable;
|
|||
public class VascMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5087600835051760512L;
|
||||
private Integer id = null;
|
||||
private String vascEntryId = null;
|
||||
private String title = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private String menuGroup = null;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private String titleKey = null;
|
||||
private String vascGroupId = null;
|
||||
/**
|
||||
* @return the vascEntryId
|
||||
*/
|
||||
public String getVascEntryId() {
|
||||
return vascEntryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryId the vascEntryId to set
|
||||
*/
|
||||
public void setVascEntryId(String vascEntryId) {
|
||||
this.vascEntryId = vascEntryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
* @return the titleKey
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
public String getTitleKey() {
|
||||
return titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
* @param titleKey the titleKey to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
public void setTitleKey(String titleKey) {
|
||||
this.titleKey = titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
* @return the vascGroupId
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
public String getVascGroupId() {
|
||||
return vascGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
* @param vascGroupId the vascGroupId to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roles
|
||||
*/
|
||||
public String getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roles the roles to set
|
||||
*/
|
||||
public void setRoles(String roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuOrder
|
||||
*/
|
||||
public Integer getMenuOrder() {
|
||||
return menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuOrder the menuOrder to set
|
||||
*/
|
||||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuGroup
|
||||
*/
|
||||
public String getMenuGroup() {
|
||||
return menuGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuGroup the menuGroup to set
|
||||
*/
|
||||
public void setMenuGroup(String menuGroup) {
|
||||
this.menuGroup = menuGroup;
|
||||
public void setVascGroupId(String vascGroupId) {
|
||||
this.vascGroupId = vascGroupId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuComparator orders the menu group.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 nov 17, 2012
|
||||
*/
|
||||
public class VascMenuComparator implements Serializable,Comparator<VascMenu> {
|
||||
|
||||
private static final long serialVersionUID = 386631856823832371L;
|
||||
|
||||
public int compare(VascMenu m1, VascMenu m2) {
|
||||
if (m1.getMenuOrder()==null) {
|
||||
return 1;
|
||||
}
|
||||
if (m2.getMenuOrder()==null) {
|
||||
return -1;
|
||||
}
|
||||
return m1.getMenuOrder().compareTo(m2.getMenuOrder());
|
||||
}
|
||||
}
|
||||
|
|
@ -35,10 +35,7 @@ public class VascMenuGroup implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -9154803561816570868L;
|
||||
private String id = null;
|
||||
private String title = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private String titleKey = null;
|
||||
private List<VascMenu> menus = null;
|
||||
|
||||
/**
|
||||
|
|
@ -54,61 +51,19 @@ public class VascMenuGroup implements Serializable {
|
|||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the titleKey
|
||||
*/
|
||||
public String getTitleKey() {
|
||||
return titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
* @param titleKey the titleKey to set
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roles
|
||||
*/
|
||||
public String getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roles the roles to set
|
||||
*/
|
||||
public void setRoles(String roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuOrder
|
||||
*/
|
||||
public Integer getMenuOrder() {
|
||||
return menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuOrder the menuOrder to set
|
||||
*/
|
||||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
public void setTitleKey(String titleKey) {
|
||||
this.titleKey = titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuGroupComparator orders the menu group.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 nov 17, 2012
|
||||
*/
|
||||
public class VascMenuGroupComparator implements Serializable,Comparator<VascMenuGroup> {
|
||||
|
||||
private static final long serialVersionUID = 386631856823832371L;
|
||||
|
||||
public int compare(VascMenuGroup m1, VascMenuGroup m2) {
|
||||
if (m1.getMenuOrder()==null) {
|
||||
return 1;
|
||||
}
|
||||
if (m2.getMenuOrder()==null) {
|
||||
return -1;
|
||||
}
|
||||
return m1.getMenuOrder().compareTo(m2.getMenuOrder());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ClientUserController {
|
||||
|
||||
String doClientLogin();
|
||||
|
||||
Map<String,String> getResourceBundle(Locale locale);
|
||||
|
||||
List<Locale> getResourceBundleLocales();
|
||||
|
||||
/*
|
||||
void doClientLogout();
|
||||
|
||||
User getUser() throws Exception;
|
||||
|
||||
List<RightRole> getClientRoles() throws Exception;
|
||||
*/
|
||||
}
|
||||
|
|
@ -1,12 +1,19 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.ejb.SessionContext;
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
@Stateless(name="loginUserController")
|
||||
public class LoginUserControllerImpl implements LoginUserControllerLocal,LoginUserControllerRemote {
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
|
||||
@Stateless(name="clientUserController")
|
||||
public class ClientUserControllerImpl implements ClientUserControllerLocal,ClientUserControllerRemote {
|
||||
|
||||
@Resource
|
||||
private SessionContext session;
|
||||
|
|
@ -54,4 +61,22 @@ public class LoginUserControllerImpl implements LoginUserControllerLocal,LoginUs
|
|||
return u.getUsername();
|
||||
*/
|
||||
}
|
||||
|
||||
public Map<String,String> getResourceBundle(Locale locale) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(RootApplicationBundle.class.getName(), locale);
|
||||
if (bundle instanceof RootApplicationBundle) {
|
||||
RootApplicationBundle appBundle = (RootApplicationBundle)bundle;
|
||||
return appBundle.getBundleData();
|
||||
}
|
||||
throw new IllegalStateException("Loaded bundle: "+bundle+" is not RootApplicationBundle.");
|
||||
}
|
||||
|
||||
public List<Locale> getResourceBundleLocales() {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(RootApplicationBundle.class.getName());
|
||||
if (bundle instanceof RootApplicationBundle) {
|
||||
RootApplicationBundle appBundle = (RootApplicationBundle)bundle;
|
||||
return appBundle.getApplicationSupportedLocales();
|
||||
}
|
||||
throw new IllegalStateException("Loaded bundle: "+bundle+" is not RootApplicationBundle.");
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,6 @@ package net.forwardfire.vasc.demo.tech.ejb3.user;
|
|||
import javax.ejb.Local;
|
||||
|
||||
@Local
|
||||
public interface LoginUserControllerLocal extends LoginUserController {
|
||||
public interface ClientUserControllerLocal extends ClientUserController {
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,6 @@ package net.forwardfire.vasc.demo.tech.ejb3.user;
|
|||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface LoginUserControllerRemote extends LoginUserController {
|
||||
public interface ClientUserControllerRemote extends ClientUserController {
|
||||
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
|
||||
public interface LoginUserController {
|
||||
|
||||
public String doClientLogin();
|
||||
|
||||
/*
|
||||
public void doClientLogout();
|
||||
|
||||
public User getUser() throws Exception;
|
||||
|
||||
public List<RightRole> getClientRoles() throws Exception;
|
||||
*/
|
||||
}
|
||||
|
|
@ -39,21 +39,7 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-xpql-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import javax.naming.Context;
|
|||
import javax.naming.InitialContext;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserController;
|
||||
import net.forwardfire.vasc.demo.tech.web.models.WebUser;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
<transaction-type>Container</transaction-type>
|
||||
</session>
|
||||
<session>
|
||||
<ejb-name>loginUserController</ejb-name>
|
||||
<business-local>net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserControllerLocal</business-local>
|
||||
<business-remote>net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserControllerRemote</business-remote>
|
||||
<ejb-class>net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserControllerImpl</ejb-class>
|
||||
<ejb-name>clientUserController</ejb-name>
|
||||
<business-local>net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserControllerLocal</business-local>
|
||||
<business-remote>net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserControllerRemote</business-remote>
|
||||
<ejb-class>net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserControllerImpl</ejb-class>
|
||||
<session-type>Stateless</session-type>
|
||||
<transaction-type>Container</transaction-type>
|
||||
</session>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
<ui:repeat var="menuGroup" value="#{menuController.vascMenuGroup}">
|
||||
<div id="body-deco-menu-group">
|
||||
<h4>
|
||||
<span><h:outputText value="#{menuGroup.title}"/></span>
|
||||
<span><h:outputText value="#{i18n[menuGroup.titleKey]}"/></span>
|
||||
</h4>
|
||||
<ul>
|
||||
<ui:repeat var="menu" value="#{menuGroup.menus}">
|
||||
<li><a href="#{contextPathController.rootPath}/vasc/#{menu.vascEntryId}/list,jsf" title="#{menu.title}">#{menu.title}</a></li>
|
||||
<li><a href="#{contextPathController.rootPath}/vasc/#{menu.vascEntryId}/list,jsf" title="#{i18n[menu.titleKey]}">#{i18n[menu.titleKey]}</a></li>
|
||||
</ui:repeat>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue