public class HttpPartitionBean implements javax.ejb.SessionBean { private javax.ejb.SessionContext mySessionCtx; private PartitionManager partitionManager; private HttpPartitionManager httpPartitionManager; /** * getSessionContext */ public javax.ejb.SessionContext getSessionContext() { return mySessionCtx; } /** * setSessionContext */ public void setSessionContext(javax.ejb.SessionContext ctx) { mySessionCtx = ctx; try { InitialContext ic = new InitialContext(); partitionManager = (PartitionManager)ic.lookup(PartitionManager. JNDI_NAME); httpPartitionManager = HttpPartitionManager.instance; partitionManager.setHttpPartitionManager(httpPartitionManager); String appName = partitionManager.getApplicationName(); httpPartitionManager.setPartitionManager(appName, partitionManager); } catch (Exception e) { throw new EJBException(e); } } /** * ejbCreate */ public void ejbCreate() throws javax.ejb.CreateException { } /** * ejbActivate */ public void ejbActivate() { } /** * ejbPassivate */ public void ejbPassivate() { } /** * ejbRemove */ public void ejbRemove() { } /** * @return */ public PartitionDefinition[] getPartitions() { return new PartitionDefinition[0]; } /** * Wird aufgerufen, wenn dem Serverprozess eine bestimmte Partition zugeordnet wird. * @param partitionName * @return */ public boolean partitionLoadEvent(String partitionName) { return false; } /** * Wird aufgerufen, wenn die zuvor zugeordnete Partition vom Server zurückgezogen wird. * @param partitionName */ public void partitionUnloadEvent(String partitionName) { } /** * Kann in regelmäßigen Abständen aufgerufen werden werden, um * zu prüfen, ob der Server ordnungsgemäß funktioniert, wenn ihm * eine Partition zugeordnet wurde. * @param partitionName * @return */ public boolean isPartitionAlive(String partitionName) { return false; } }Die Methode getPartitions() (in Zeile 254) gibt einfach einen leeren Array von Partitionsdefinitionen zurück, weil diese EJB keine Partitionen spezifiziert. Damit diese EJB Partitionen zurückgibt, müsste die Methode setPartitions() im HttpPartitionManager aufgerufen werden. Außerdem könnte die EJB durch den Aufruf der Methode setExpressions() HTTP-Anforderungsausdrücke spezifizieren.
Related concepts
EJB-API: HttpPartitionBean erweitern