[jboss-cvs] JBossAS SVN: r103270 - in projects/profileservice/trunk: build and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 30 11:42:00 EDT 2010
Author: emuckenhuber
Date: 2010-03-30 11:41:58 -0400 (Tue, 30 Mar 2010)
New Revision: 103270
Removed:
projects/profileservice/trunk/sandbox/
Modified:
projects/profileservice/trunk/
projects/profileservice/trunk/build/
projects/profileservice/trunk/core/
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java
projects/profileservice/trunk/domain/
projects/profileservice/trunk/persistence/
projects/profileservice/trunk/plugins/
projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStartAction.java
projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStopAction.java
projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java
projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java
projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/UpdateComponentAction.java
projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java
projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java
projects/profileservice/trunk/pom.xml
projects/profileservice/trunk/spi/
Log:
svn:ignore and remove not used subproject
Property changes on: projects/profileservice/trunk
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
.settings
target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
Property changes on: projects/profileservice/trunk/build
___________________________________________________________________
Name: svn:ignore
- target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
Property changes on: projects/profileservice/trunk/core
___________________________________________________________________
Name: svn:ignore
- target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -103,7 +103,7 @@
ProfileKey key = context.getProfileKey();
fireModificationEvent(new ProfileLifeCycleEvent(key, LifeCycleState.UNINSTALLED));
// Remove
- this.profiles.remove(key);
+ this.profiles.remove(key.getName());
ProfileWrapper wrapper = this.profilesByName.remove(key);
if(wrapper != null)
{
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -96,12 +96,12 @@
scanner1.start();
scanner2.scan();
assertTrue(scanner1.isScheduled());
- Thread.sleep(6);
+ Thread.sleep(7);
scanner2.start();
assertTrue(scanner1.getScanCount() > 0);
scanner1.scan();
- Thread.sleep(6);
+ Thread.sleep(7);
assertTrue(scanner2.getScanCount() > 0);
scanner2.stop();
@@ -146,7 +146,7 @@
scanner2.start();
- Thread.sleep(6);
+ Thread.sleep(7);
assertTrue(scanner1.isScheduled());
assertTrue(scanner2.isScheduled());
@@ -224,30 +224,24 @@
return Collections.emptySet();
}
- @Override
public void addDeployment(ProfileDeployment deployment) throws Exception
{
}
- @Override
public void enableModifiedDeploymentChecks(boolean flag)
{
}
- @Override
public ProfileDeployment removeDeployment(String name) throws NoSuchDeploymentException, Exception
{
return null;
}
- @Override
public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException
{
return null;
}
- @Override
public Set<String> getDeploymentNames()
{
return null;
}
- @Override
public Collection<ProfileDeployment> getDeployments()
{
return null;
@@ -256,7 +250,6 @@
{
return 0;
}
- @Override
public boolean hasDeployment(String name)
{
return false;
@@ -265,7 +258,6 @@
{
return null;
}
- @Override
public boolean isMutable()
{
return true;
Property changes on: projects/profileservice/trunk/domain
___________________________________________________________________
Name: svn:ignore
- target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
Property changes on: projects/profileservice/trunk/persistence
___________________________________________________________________
Name: svn:ignore
- target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
Property changes on: projects/profileservice/trunk/plugins
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
.settings
target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStartAction.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStartAction.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStartAction.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -103,6 +103,7 @@
{
// ERROR reporting
log.error("failed to start deployments: " + getDeploymentNames(), e);
+ return false;
}
return true;
}
@@ -142,8 +143,6 @@
}
// Process
deployer.process();
-
- // deployer.checkComplete(resolvedNames());
}
protected void doRollbackFromRollbackOnly()
Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStopAction.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStopAction.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentStopAction.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -94,6 +94,7 @@
{
// ERROR reporting
log.error("failed to start deployments: " + getDeploymentNames(), e);
+ return false;
}
return true;
}
Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -38,14 +38,8 @@
import org.jboss.logging.Logger;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.Fields;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ActivationPolicy;
-import org.jboss.managed.api.annotation.ViewUse;
-import org.jboss.metatype.api.values.MetaValue;
import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
import org.jboss.profileservice.plugins.spi.ProfileView;
import org.jboss.profileservice.plugins.spi.ProfileViewWrapper;
@@ -503,8 +497,8 @@
{
throw new IllegalStateException("failed to resolve target profile for component " + serverComponent);
}
-
- // TODO 1) finish implementation 2) create ModificationAction
+ // Delegate request to handling wrapper.
+ target.removeComponent(comp, serverComponent);
}
/**
@@ -529,84 +523,11 @@
{
throw new IllegalStateException("failed to resolve target profile for component " + serverComponent);
}
-
- // Dispatch any runtime component property values
- for(ManagedProperty prop : comp.getProperties().values())
- {
- // Skip null values && non-CONFIGURATION values, unmodified values, and removed values
- boolean skip = prop.getValue() == null
- || prop.isReadOnly()
- || prop.hasViewUse(ViewUse.CONFIGURATION) == false
-// || prop.isModified() == false
- || prop.isRemoved() == true;
- if( skip )
- {
- if(log.isTraceEnabled())
- log.trace("Skipping component property: "+prop);
- continue;
- }
-
- ManagedProperty ctxProp = serverComponent.getProperties().get(prop.getName());
- // Check for a mapped name
- if( ctxProp == null )
- {
- String mappedName = prop.getMappedName();
- if( mappedName != null )
- ctxProp = serverComponent.getProperties().get(mappedName);
- }
- if( ctxProp == null )
- {
- formatter.applyPattern(i18n.getString("ManagementView.InvalidTemplateProperty")); //$NON-NLS-1$
- Object[] args = {prop.getName()};
- String msg = formatter.format(args);
- throw new IllegalArgumentException(msg);
- }
- // The property value must be a MetaValue
- Object value = prop.getValue();
- if ((value instanceof MetaValue) == false)
- {
- formatter.applyPattern(i18n.getString("ManagementView.InvalidPropertyValue")); //$NON-NLS-1$
- Object[] args = {prop.getName(), value.getClass()};
- String msg = formatter.format(args);
- throw new IllegalArgumentException(msg);
- }
- // Update the serverComp
- MetaValue metaValue = (MetaValue)value;
- ctxProp.setField(Fields.META_TYPE, metaValue.getMetaType());
- ctxProp.setValue(metaValue);
-
- // Dispatch any runtime component property values
- Object componentName = getComponentName(ctxProp);
- ActivationPolicy policy = ctxProp.getActivationPolicy();
-
- if (componentName != null && policy.equals(ActivationPolicy.IMMEDIATE))
- {
- getProxyFactory().getDispatcher().set(componentName, ctxProp.getName(), metaValue);
- }
- }
-
- // TODO 1) finish implementation 2) just create ModificationAction
+ // Delegate request to handling wrapper.
+ target.updateComponent(comp, serverComponent);
}
/**
- * Get the component name from managed property.
- *
- * @param property the managed property
- * @return component name or null if no coresponding component
- */
- protected Object getComponentName(ManagedProperty property)
- {
- // first check target
- ManagedObject targetObject = property.getTargetManagedObject();
- if (targetObject != null)
- return targetObject.getComponentName();
-
- // check owner
- targetObject = property.getManagedObject();
- return targetObject != null ? targetObject.getComponentName() : null;
- }
-
- /**
* Try to resolve the target profile.
*
* @param deploymentName the deployment name
Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -21,9 +21,11 @@
*/
package org.jboss.profileservice.plugins.management;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -36,6 +38,7 @@
import org.jboss.profileservice.management.event.ProfileLifeCycleEvent;
import org.jboss.profileservice.management.event.ProfileLifeCycleEvent.LifeCycleState;
import org.jboss.profileservice.plugins.management.actions.ProfileViewUpdateAction;
+import org.jboss.profileservice.plugins.management.actions.UpdateComponentAction;
import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
import org.jboss.profileservice.plugins.management.view.RegisteredProfileView;
import org.jboss.profileservice.plugins.spi.ProfileView;
@@ -294,14 +297,14 @@
/**
* {@inheritDoc}
*/
- public void notify(ModificationEvent event)
+ public void notify(final ModificationEvent event)
{
if(event instanceof ProfileLifeCycleEvent)
{
ProfileLifeCycleEvent lifeCycle = ProfileLifeCycleEvent.class.cast(event);
if(lifeCycle.getState() == LifeCycleState.UNINSTALLED)
{
- // TODO remove
+ // TODO remove ?
}
}
}
@@ -320,12 +323,19 @@
public void removeComponent(ManagedComponent update, ManagedComponent original) throws Exception
{
- //
+ // TODO
}
public void updateComponent(ManagedComponent update, ManagedComponent original) throws Exception
{
- //
+ ManagedDeployment deployment = original.getDeployment();
+ ProfileKey key = resolveProfile(deployment.getName());
+
+ ProfileModificationAction updateComponentAction = new UpdateComponentAction(update, original, proxyFactory, null);
+ List<ProfileModificationAction<ProfileModificationContext>> actions = new ArrayList<ProfileModificationAction<ProfileModificationContext>>();
+ actions.add(updateComponentAction);
+ this.controller.perform(key, ProfileModificationType.UPDATE, actions);
+
}
}
Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/UpdateComponentAction.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/UpdateComponentAction.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/UpdateComponentAction.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -21,7 +21,16 @@
*/
package org.jboss.profileservice.plugins.management.actions;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ActivationPolicy;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metatype.api.values.MetaValue;
import org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction;
+import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
import org.jboss.profileservice.spi.action.management.ManagementAction;
import org.jboss.profileservice.spi.action.management.ManagementActionContext;
@@ -32,9 +41,20 @@
public class UpdateComponentAction extends AbstractTwoPhaseModificationAction<ManagementActionContext> implements ManagementAction<ManagementActionContext>
{
- public UpdateComponentAction(ManagementActionContext modificationContext)
+ private static final Logger log = Logger.getLogger(UpdateComponentAction.class);
+
+ private ManagedComponent updatedComponent;
+ private ManagedComponent serverComponent;
+ private AbstractManagementProxyFactory proxyFactory;
+
+ public UpdateComponentAction(ManagedComponent updatedComponent, ManagedComponent serverComponent,
+ AbstractManagementProxyFactory proxyFactory,
+ ManagementActionContext modificationContext)
{
super(modificationContext);
+ this.updatedComponent = updatedComponent;
+ this.serverComponent = serverComponent;
+ this.proxyFactory = proxyFactory;
}
protected void doCancel()
@@ -57,8 +77,61 @@
protected boolean doPrepare()
{
- // FIXME doPrepare
- return false;
+ try
+ {
+ // Dispatch any runtime component property values
+ for(ManagedProperty prop : updatedComponent.getProperties().values())
+ {
+ // Skip null values && non-CONFIGURATION values, unmodified values, and removed values
+ boolean skip = prop.getValue() == null
+ || prop.isReadOnly()
+ || prop.hasViewUse(ViewUse.CONFIGURATION) == false
+// || prop.isModified() == false
+ || prop.isRemoved() == true;
+ if( skip )
+ {
+ continue;
+ }
+
+ ManagedProperty ctxProp = serverComponent.getProperties().get(prop.getName());
+ // Check for a mapped name
+ if( ctxProp == null )
+ {
+ String mappedName = prop.getMappedName();
+ if( mappedName != null )
+ ctxProp = serverComponent.getProperties().get(mappedName);
+ }
+ if( ctxProp == null )
+ {
+ throw new IllegalArgumentException("trying to update non existing property." + prop.getName());
+ }
+ // The property value must be a MetaValue
+ Object value = prop.getValue();
+ if ((value instanceof MetaValue) == false)
+ {
+ throw new IllegalArgumentException("invalid value for property " + prop.getName());
+ }
+ // Update the serverComp
+ MetaValue metaValue = (MetaValue)value;
+ ctxProp.setField(Fields.META_TYPE, metaValue.getMetaType());
+ ctxProp.setValue(metaValue);
+
+ // Dispatch any runtime component property values
+ Object componentName = getComponentName(ctxProp);
+ ActivationPolicy policy = ctxProp.getActivationPolicy();
+
+ if (componentName != null && policy.equals(ActivationPolicy.IMMEDIATE))
+ {
+ getProxyFactory().getDispatcher().set(componentName, ctxProp.getName(), metaValue);
+ }
+ }
+ }
+ catch(Throwable t)
+ {
+ log.error("failed to update managed component", t);
+ return false;
+ }
+ return true;
}
protected void doRollbackFromActive()
@@ -91,5 +164,28 @@
}
+ public AbstractManagementProxyFactory getProxyFactory()
+ {
+ return proxyFactory;
+ }
+
+ /**
+ * Get the component name from managed property.
+ *
+ * @param property the managed property
+ * @return component name or null if no coresponding component
+ */
+ protected Object getComponentName(ManagedProperty property)
+ {
+ // first check target
+ ManagedObject targetObject = property.getTargetManagedObject();
+ if (targetObject != null)
+ return targetObject.getComponentName();
+
+ // check owner
+ targetObject = property.getManagedObject();
+ return targetObject != null ? targetObject.getComponentName() : null;
+ }
+
}
Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -31,7 +31,6 @@
import org.jboss.managed.api.factory.ManagedObjectFactory;
import org.jboss.managed.plugins.ManagedDeploymentImpl;
import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
import org.jboss.test.BaseTestCase;
import org.jboss.test.profileservice.plugins.mgt.support.NoopManagementProxyFactory;
import org.jboss.test.profileservice.plugins.mgt.support.TestComponentMetaData;
@@ -52,9 +51,6 @@
/** A noop proxy factory. */
private static final NoopManagementProxyFactory proxyFactory = new NoopManagementProxyFactory();
- /** The helper. */
- private ManagedDeploymentProcessor helper;
-
public AbstractViewTestBase(String name)
{
super(name);
@@ -69,16 +65,10 @@
{
return proxyFactory;
}
-
- public ManagedDeploymentProcessor getHelper()
- {
- return helper;
- }
public void setUp() throws Exception
{
super.setUp();
- this.helper = new ManagedDeploymentProcessor(proxyFactory);
}
protected ManagedDeployment createDeployment(String name, Object... objects)
Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/SimpleViewUnitTestCase.java 2010-03-30 15:41:58 UTC (rev 103270)
@@ -23,6 +23,7 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
import org.jboss.profileservice.plugins.management.view.AbstractProfileView;
import org.jboss.test.profileservice.plugins.mgt.support.TestComponentMetaData;
@@ -33,11 +34,25 @@
public class SimpleViewUnitTestCase extends AbstractViewTestBase
{
+ /** The helper. */
+ private ManagedDeploymentProcessor helper;
+
public SimpleViewUnitTestCase(String name)
{
super(name);
}
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.helper = new ManagedDeploymentProcessor(getProxyfactory());
+ }
+
+ public ManagedDeploymentProcessor getHelper()
+ {
+ return helper;
+ }
+
public void testSimple() throws Exception
{
AbstractProfileView view = new AbstractProfileView();
Modified: projects/profileservice/trunk/pom.xml
===================================================================
--- projects/profileservice/trunk/pom.xml 2010-03-30 15:22:09 UTC (rev 103269)
+++ projects/profileservice/trunk/pom.xml 2010-03-30 15:41:58 UTC (rev 103270)
@@ -61,7 +61,6 @@
<module>domain</module>
<module>core</module>
<module>plugins</module>
- <module>sandbox</module>
<module>build</module>
</modules>
Property changes on: projects/profileservice/trunk/spi
___________________________________________________________________
Name: svn:ignore
- target
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
More information about the jboss-cvs-commits
mailing list