Java Code Examples for javax.ejb.TransactionAttributeType#NOT_SUPPORTED
The following examples show how to use
javax.ejb.TransactionAttributeType#NOT_SUPPORTED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProducerSB.java From solace-integration-guides with Apache License 2.0 | 6 votes |
@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED) @Override public void sendMessage() throws JMSException { System.out.println("Sending reply message"); Connection conn = null; Session session = null; MessageProducer prod = null; try { conn = myCF.createConnection(); session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); prod = session.createProducer(myReplyQueue); ObjectMessage msg = session.createObjectMessage(); msg.setObject("Hello world!"); prod.send(msg, DeliveryMode.PERSISTENT, 0, 0); } finally { if (prod != null) prod.close(); if (session != null) session.close(); if (conn != null) conn.close(); } }
Example 2
Source File: IaasController.java From development with Apache License 2.0 | 6 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus deactivateInstance(String instanceId, ProvisioningSettings settings) throws APPlatformException { try { PropertyHandler paramHandler = new PropertyHandler(settings); if (paramHandler.isVirtualSystemProvisioning()) { paramHandler.setOperation(Operation.VSYSTEM_ACTIVATION); paramHandler.setState(FlowState.VSYSTEM_DEACTIVATION_REQUESTED); } else { paramHandler.setOperation(Operation.VSERVER_ACTIVATION); paramHandler.setState(FlowState.VSERVER_DEACTIVATION_REQUESTED); } InstanceStatus result = new InstanceStatus(); result.setChangedParameters(settings.getParameters()); result.setChangedAttributes(settings.getAttributes()); return result; } catch (Exception e) { logger.error("Error while scheduling instance deactivation", e); throw getPlatformException(e, "error_deactivation_overall"); } }
Example 3
Source File: VMController.java From development with Apache License 2.0 | 6 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus deactivateInstance(String instanceId, ProvisioningSettings settings) throws APPlatformException { logger.info("deactivateInstance({})", LogAndExceptionConverter.getLogText(instanceId, settings)); try { StateMachine.initializeProvisioningSettings(settings, "deactivate_vm.xml"); InstanceStatus result = new InstanceStatus(); result.setChangedParameters(settings.getParameters()); return result; } catch (Throwable t) { throw LogAndExceptionConverter.createAndLogPlatformException(t, Context.DEACTIVATION); } }
Example 4
Source File: VMController.java From development with Apache License 2.0 | 6 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus activateInstance(String instanceId, ProvisioningSettings settings) throws APPlatformException { logger.info("activateInstance({})", LogAndExceptionConverter.getLogText(instanceId, settings)); try { StateMachine.initializeProvisioningSettings(settings, "activate_vm.xml"); InstanceStatus result = new InstanceStatus(); result.setChangedParameters(settings.getParameters()); return result; } catch (Throwable t) { throw LogAndExceptionConverter.createAndLogPlatformException(t, Context.ACTIVATION); } }
Example 5
Source File: OpenStackController.java From development with Apache License 2.0 | 6 votes |
/** * Starts the modification of an application instance. * <p> * The internal status <code>MODIFICATION_REQUESTED</code> is stored as a * controller configuration setting. It is evaluated and handled by the * status dispatcher, which is invoked at regular intervals by APP through * the <code>getInstanceStatus</code> method. * * @param instanceId * the ID of the application instance to be modified * @param currentSettings * a <code>ProvisioningSettings</code> object specifying the * current service parameters and configuration settings * @param newSettings * a <code>ProvisioningSettings</code> object specifying the * modified service parameters and configuration settings * @return an <code>InstanceStatus</code> instance with the overall status * of the application instance * @throws APPlatformException */ @Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus modifyInstance(String instanceId, ProvisioningSettings currentSettings, ProvisioningSettings newSettings) throws APPlatformException { LOGGER.info("modifyInstance({})", LogAndExceptionConverter .getLogText(instanceId, currentSettings)); try { newSettings.getParameters().put(PropertyHandler.STACK_NAME, currentSettings.getParameters() .get(PropertyHandler.STACK_NAME)); PropertyHandler ph = new PropertyHandler(newSettings); ph.setState(FlowState.MODIFICATION_REQUESTED); InstanceStatus result = new InstanceStatus(); result.setChangedParameters(newSettings.getParameters()); result.setChangedAttributes(newSettings.getAttributes()); return result; } catch (Exception t) { throw LogAndExceptionConverter.createAndLogPlatformException(t, Context.MODIFICATION); } }
Example 6
Source File: OpenStackController.java From development with Apache License 2.0 | 6 votes |
/** * Starts the deactivation of an application instance. * <p> * The internal status <code>DEACTIVATION_REQUESTED</code> is stored as a * controller configuration setting. It is evaluated and handled by the * status dispatcher, which is invoked at regular intervals by APP through * the <code>getInstanceStatus</code> method. * * @param instanceId * the ID of the application instance to be activated * @param settings * a <code>ProvisioningSettings</code> object specifying the * service parameters and configuration settings * @return an <code>InstanceStatus</code> instance with the overall status * of the application instance * @throws APPlatformException */ @Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus deactivateInstance(String instanceId, ProvisioningSettings settings) throws APPlatformException { LOGGER.info("deactivateInstance({})", LogAndExceptionConverter.getLogText(instanceId, settings)); try { // Set status to store for application instance PropertyHandler ph = new PropertyHandler(settings); ph.setState(FlowState.DEACTIVATION_REQUESTED); InstanceStatus result = new InstanceStatus(); result.setChangedParameters(settings.getParameters()); result.setChangedAttributes(settings.getAttributes()); return result; } catch (Exception t) { throw LogAndExceptionConverter.createAndLogPlatformException(t, Context.DEACTIVATION); } }
Example 7
Source File: VMController.java From development with Apache License 2.0 | 6 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus getInstanceStatus(String instanceId, ProvisioningSettings settings) throws APPlatformException { logger.debug("{}", LogAndExceptionConverter.getLogText(instanceId, settings)); try { VMPropertyHandler ph = new VMPropertyHandler(settings); InstanceStatus status = new InstanceStatus(); StateMachine stateMachine = new StateMachine(settings); stateMachine.executeAction(settings, instanceId, status); updateProvisioningSettings(ph, stateMachine, instanceId); status.setChangedParameters(settings.getParameters()); return status; } catch (SuspendException e) { throw e; } catch (Throwable t) { logger.error( "Failed to get instance status for instance " + instanceId, t); throw new SuspendException( "Failed to get instance status for instance " + instanceId, new APPlatformException(t.getMessage())); } }
Example 8
Source File: SampleController.java From development with Apache License 2.0 | 6 votes |
/** * Starts the creation of an application instance and returns the instance * ID. * <p> * The internal status <code>CREATION_REQUESTED</code> is stored as a * controller configuration setting. It is evaluated and handled by the * status dispatcher, which is invoked at regular intervals by APP through * the <code>getInstanceStatus</code> method. * * @param settings * a <code>ProvisioningSettings</code> object specifying the * service parameters and configuration settings * @return an <code>InstanceDescription</code> instance describing the * application instance * @throws APPlatformException */ @Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceDescription createInstance(ProvisioningSettings settings) throws APPlatformException { // Set status to store for application instance PropertyHandler paramHandler = new PropertyHandler(settings); paramHandler.setState(Status.CREATION_REQUESTED); // Return generated instance information InstanceDescription id = new InstanceDescription(); id.setInstanceId("Instance_" + System.currentTimeMillis()); id.setChangedParameters(settings.getParameters()); id.setChangedAttributes(settings.getAttributes()); return id; }
Example 9
Source File: EJB_08_NOT_SUPPORTED.java From testing_security_development_enterprise_systems with GNU Lesser General Public License v3.0 | 5 votes |
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void createFooNotSupported(String name){ Foo foo = new Foo(name); em.persist(foo); //will fail out of a transaction // NOTE: only as example... usually would not have a "persist" in // a NOT_SUPPORTED method }
Example 10
Source File: EJB_08_NOT_SUPPORTED.java From testing_security_development_enterprise_systems with GNU Lesser General Public License v3.0 | 5 votes |
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void createFooNotSupported(String name){ Foo foo = new Foo(name); em.persist(foo); //will fail out of a transaction // NOTE: only as example... usually would not have a "persist" in // a NOT_SUPPORTED method }
Example 11
Source File: VMController.java From development with Apache License 2.0 | 5 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceDescription createInstance(ProvisioningSettings settings) throws APPlatformException { try { VMPropertyHandler ph = new VMPropertyHandler(settings); ph.setRequestingUser(settings.getRequestingUser()); InstanceDescription id = new InstanceDescription(); id.setInstanceId(Long.toString(System.currentTimeMillis())); id.setChangedParameters(settings.getParameters()); if (platformService.exists(Controller.ID, id.getInstanceId())) { logger.error( "Other instance with same name already registered in CTMG: [" + id.getInstanceId() + "]"); throw new APPlatformException( Messages.getAll("error_instance_exists", new Object[] { id.getInstanceId() })); } validateParameters(null, ph, settings.getOrganizationId(), id.getInstanceId()); logger.info("createInstance({})", LogAndExceptionConverter .getLogText(id.getInstanceId(), settings)); StateMachine.initializeProvisioningSettings(settings, "create_vm.xml"); return id; } catch (Exception e) { throw LogAndExceptionConverter.createAndLogPlatformException(e, Context.CREATION); } }
Example 12
Source File: IaasController.java From development with Apache License 2.0 | 5 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus deleteUsers(String instanceId, ProvisioningSettings settings, List<ServiceUser> users) throws APPlatformException { return null; }
Example 13
Source File: IaasController.java From development with Apache License 2.0 | 5 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus notifyInstance(String instanceId, ProvisioningSettings settings, Properties properties) throws APPlatformException { InstanceStatus status = null; if (instanceId == null || settings == null || properties == null) { return status; } PropertyHandler propertyHandler = new PropertyHandler(settings); if ("finish".equals(properties.get("command"))) { // since deletion currently does not have manual steps, the event // can be ignored if (!propertyHandler.getOperation().isDeletion()) { if (FlowState.MANUAL.equals(propertyHandler.getState())) { propertyHandler.setState(FlowState.FINISHED); status = setNotificationStatus(settings, propertyHandler); logger.debug("Got finish event => changing instance status to finished"); } else { APPlatformException pe = new APPlatformException( "Got finish event but instance is in state " + propertyHandler.getState() + " => nothing changed"); logger.debug(pe.getMessage()); throw pe; } } } return status; }
Example 14
Source File: IaasController.java From development with Apache License 2.0 | 5 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public List<LocalizedText> getControllerStatus(ControllerSettings settings) throws APPlatformException { // TODO Auto-generated method stub return null; }
Example 15
Source File: AppComposerAsJUnitRuleWithReusableModulesTest.java From tomee with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public Validator getValidator() { return validator; }
Example 16
Source File: VMController.java From development with Apache License 2.0 | 4 votes |
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public List<LocalizedText> getControllerStatus(ControllerSettings arg0) throws APPlatformException { return null; }
Example 17
Source File: EJB_09_NEVER.java From testing_security_development_enterprise_systems with GNU Lesser General Public License v3.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public boolean getFromNotSupported(){ EJB_09_NEVER ejb = ctx.getBusinessObject(EJB_09_NEVER.class); return ejb.getTrue(); //will not fail, as the transaction (if any) was suspended }
Example 18
Source File: AWSController.java From development with Apache License 2.0 | 3 votes |
/** * Does not carry out specific actions in this implementation and always * returns <code>null</code>. * * @param instanceId * the ID of the application instance * @param settings * a <code>ProvisioningSettings</code> object specifying the * service parameters and configuration settings * @param users * a list of users * @return <code>null</code> * @throws APPlatformException */ @Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatusUsers createUsers(String instanceId, ProvisioningSettings settings, List<ServiceUser> users) throws APPlatformException { return null; }
Example 19
Source File: SampleController.java From development with Apache License 2.0 | 3 votes |
/** * Does not carry out specific actions in this implementation and always * returns <code>null</code>. * * @param instanceId * the ID of the application instance * @param settings * a <code>ProvisioningSettings</code> object specifying the * service parameters and configuration settings * @param users * a list of users * @return <code>null</code> * @throws APPlatformException */ @Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatusUsers createUsers(String instanceId, ProvisioningSettings settings, List<ServiceUser> users) throws APPlatformException { return null; }
Example 20
Source File: OpenStackController.java From development with Apache License 2.0 | 3 votes |
/** * Does not carry out specific actions in this implementation and always * returns <code>null</code>. * * @param instanceId * the ID of the application instance * @param settings * a <code>ProvisioningSettings</code> object specifying the * service parameters and configuration settings * @param users * a list of users * @return <code>null</code> * @throws APPlatformException */ @Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus updateUsers(String instanceId, ProvisioningSettings settings, List<ServiceUser> users) throws APPlatformException { return null; }