/** * Executes some logic on some config beans protected by a transaction. * * @param code code to execute * @param objects config beans participating to the transaction * @return list of property change events * @throws TransactionFailure when the code did run successfully due to a * transaction exception */ public static Object apply(ConfigCode code, ConfigBeanProxy... objects) throws TransactionFailure { ConfigBean source = (ConfigBean) ConfigBean.unwrap(objects[0]); return source.getHabitat().<ConfigSupport>getService(ConfigSupport.class)._apply(code, objects); }
public void testGetConfigBean() { SimpleConnector sc = habitat.getService(SimpleConnector.class); final EjbContainerAvailability ejb = sc.getEjbContainerAvailability(); ConfigBean ejbConfigBean = (ConfigBean) ConfigBean.unwrap(ejb); assert(ejbConfigBean != null); }
@Override void prepareInjection(final AdminCommandContext ctx) { super.prepareInjection(ctx); tgt = resolver.resolve(ctx, targetType); if (tgt != null) { child = (ConfigBean) ConfigBean.unwrap(tgt); } }
public Object run(final ConfigBeanProxy... params) throws PropertyVetoException, TransactionFailure { if (params.length != 1) { throw new IllegalArgumentException(); } final ConfigBeanProxy parent = params[0]; final ConfigBean source = (ConfigBean) ConfigBean.unwrap(parent); final ConfigSupport configSupport = source.getHabitat().getService(ConfigSupport.class); return _run(parent, configSupport); }
/** This is a workaround for the fact that the onEntered() is not being called in all cases, namely during deployment before AMX has loaded. See disableTransactionListener() above. */ @Override public synchronized void transactionCommited(final List<PropertyChangeEvent> events) { // could there be an add/remove/add/remove of the same thing? Maintain the order just in case for (final PropertyChangeEvent event : events) { final Object oldValue = event.getOldValue(); final Object newValue = event.getNewValue(); if (oldValue == null && newValue instanceof ConfigBeanProxy) { // ADD: a new ConfigBean was added final ConfigBean cb = asConfigBean(ConfigBean.unwrap((ConfigBeanProxy) newValue)); add(cb); } else if (newValue == null && (oldValue instanceof ConfigBeanProxy)) { // REMOVE final ConfigBean cb = asConfigBean(ConfigBean.unwrap((ConfigBeanProxy) oldValue)); remove(cb); } } }
/** * Executes some logic on some config beans protected by a transaction. * * @param code code to execute * @param objects config beans participating to the transaction * @return list of property change events * @throws TransactionFailure when the code did run successfully due to a * transaction exception */ public static Object apply(ConfigCode code, ConfigBeanProxy... objects) throws TransactionFailure { ConfigBean source = (ConfigBean) ConfigBean.unwrap(objects[0]); return source.getHabitat().getComponent(ConfigSupport.class)._apply(code, objects); }
/** * Executes some logic on some config beans protected by a transaction. * * @param code code to execute * @param objects config beans participating to the transaction * @return list of property change events * @throws TransactionFailure when the code did run successfully due to a * transaction exception */ public static Object apply(ConfigCode code, ConfigBeanProxy... objects) throws TransactionFailure { ConfigBean source = (ConfigBean) ConfigBean.unwrap(objects[0]); return source.getHabitat().<ConfigSupport>getService(ConfigSupport.class)._apply(code, objects); }
/** * Executes some logic on some config beans protected by a transaction. * * @param code code to execute * @param objects config beans participating to the transaction * @return list of property change events * @throws TransactionFailure when the code did run successfully due to a * transaction exception */ public static Object apply(ConfigCode code, ConfigBeanProxy... objects) throws TransactionFailure { ConfigBean source = (ConfigBean) ConfigBean.unwrap(objects[0]); return source.getHabitat().<ConfigSupport>getService(ConfigSupport.class)._apply(code, objects); }
/** * Executes some logic on some config beans protected by a transaction. * * @param code code to execute * @param objects config beans participating to the transaction * @return list of property change events * @throws TransactionFailure when the code did run successfully due to a * transaction exception */ public static Object apply(ConfigCode code, ConfigBeanProxy... objects) throws TransactionFailure { ConfigBean source = (ConfigBean) ConfigBean.unwrap(objects[0]); return source.getHabitat().getComponent(ConfigSupport.class)._apply(code, objects); }
public void testGetConfigBean() { SimpleConnector sc = habitat.getService(SimpleConnector.class); final EjbContainerAvailability ejb = sc.getEjbContainerAvailability(); ConfigBean ejbConfigBean = (ConfigBean) ConfigBean.unwrap(ejb); assert(ejbConfigBean != null); }
public Transaction prepareAppConfigChanges(final DeploymentContext context) throws TransactionFailure { final Properties appProps = context.getAppProps(); final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class); Transaction t = new Transaction(); try { // prepare the application element ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class); Application app = newBean.createProxy(); Application app_w = t.enroll(app); setInitialAppAttributes(app_w, deployParams, appProps, context); context.addTransientAppMetaData(ServerTags.APPLICATION, app_w); } catch(TransactionFailure e) { t.rollback(); throw e; } catch (Exception e) { t.rollback(); throw new TransactionFailure(e.getMessage(), e); } return t; }
public Transaction prepareAppConfigChanges(final DeploymentContext context) throws TransactionFailure { final Properties appProps = context.getAppProps(); final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class); Transaction t = new Transaction(); try { // prepare the application element ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class); Application app = newBean.createProxy(); Application app_w = t.enroll(app); setInitialAppAttributes(app_w, deployParams, appProps, context); context.addTransientAppMetaData(ServerTags.APPLICATION, app_w); } catch(TransactionFailure e) { t.rollback(); throw e; } catch (Exception e) { t.rollback(); throw new TransactionFailure(e.getMessage(), e); } return t; }
return; final ConfigBean child = (ConfigBean) ConfigBean.unwrap(target);