You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2009/11/05 19:59:30 UTC
svn commit: r833127 - in /geronimo/server/trunk/plugins/openejb:
geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/
openejb-portlets/src/main/java/org/apache/geronimo/console/ejbserver/
Author: rickmcguire
Date: Thu Nov 5 18:59:30 2009
New Revision: 833127
URL: http://svn.apache.org/viewvc?rev=833127&view=rev
Log:
openejb cleanup changes
Modified:
geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
geronimo/server/trunk/plugins/openejb/openejb-portlets/src/main/java/org/apache/geronimo/console/ejbserver/EjbHelper.java
Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java?rev=833127&r1=833126&r2=833127&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java Thu Nov 5 18:59:30 2009
@@ -73,6 +73,8 @@
import org.apache.xmlbeans.QNameSet;
import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.Bundle;
+
/**
*
* @version $Rev:$ $Date:$
@@ -81,7 +83,7 @@
private static final QName BASE_CLUSTERING_QNAME = GerClusteringDocument.type.getDocumentElementName();
private static final QName CLUSTERING_WADI_QNAME = GerOpenejbClusteringWadiDocument.type.getDocumentElementName();
private static final QNameSet CLUSTERING_WADI_QNAME_SET = QNameSet.singleton(CLUSTERING_WADI_QNAME);
-
+
static {
SchemaConversionUtils.registerNamespaceConversions(
Collections.singletonMap(CLUSTERING_WADI_QNAME.getLocalPart(),
@@ -104,7 +106,7 @@
int defaultNumPartitions,
AbstractNameQuery defaultBackingStrategyFactoryName,
AbstractNameQuery defaultClusterName,
- AbstractNameQuery defaultNetworkConnectorName,
+ AbstractNameQuery defaultNetworkConnectorName,
Environment defaultEnvironment) {
if (null == defaultClusteredStatefulContainerId) {
throw new IllegalArgumentException("defaultClusteredStatefulContainerId is required");
@@ -131,9 +133,9 @@
this.defaultClusterName = defaultClusterName;
this.defaultNetworkConnectorName = defaultNetworkConnectorName;
this.defaultEnvironment = defaultEnvironment;
-
+
beanNameBuilder = new BasicEjbDeploymentGBeanNameBuilder();
-
+
new NamespaceDrivenBuilderCollection(Collections.<NamespaceDrivenBuilder>singleton(new NamespaceDrivenBuilder() {
public void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext moduleContext)
throws DeploymentException {
@@ -156,11 +158,11 @@
}));
}
-
- public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository)
+
+ public void addGBeans(EARContext earContext, Module module, Bundle bundle, Collection repository)
throws DeploymentException {
EjbModule ejbModule = (EjbModule) module;
-
+
OpenejbGeronimoEjbJarType geronimoEjbJarType = ejbModule.getVendorDD();
GerOpenejbClusteringWadiType clusteringWadiType = getWadiClusterConfig(geronimoEjbJarType);
if (clusteringWadiType != null) {
@@ -229,9 +231,9 @@
ejbModule.getPreAutoConfigDeployer().add(new MapSFSBToContainerIDDeployer(defaultClusteredStatefulContainerId));
}
- public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+ public void initContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
}
-
+
public void installModule(JarFile earFile,
EARContext earContext,
Module module,
@@ -256,14 +258,14 @@
return name;
}
-
+
protected void setClusteredServiceHolders(DeploymentContext moduleContext, GBeanData beanData)
throws DeploymentException {
AbstractName name = newGBeanName(moduleContext, "NetworkConnectorTrackerHolder");
GBeanData serviceHolder = new GBeanData(name, BasicNetworkConnectorTrackerServiceHolder.GBEAN_INFO);
addGBean(moduleContext, serviceHolder);
-
+
beanData.setReferencePattern(BasicWADISessionManager.GBEAN_REF_SERVICE_HOLDERS, name);
}
@@ -278,7 +280,7 @@
new AbstractNameQuery(ClusteredStatefulDeployment.class.getName()));
networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_WADI_SESSION_MANAGER,
sessionManagerName);
-
+
addGBean(moduleContext, networkConnectorMonitor);
}
@@ -327,7 +329,7 @@
Integer sessionTimeout = getSessionTimeout();
boolean disableReplication = isDisableReplication(clustering);
boolean deltaReplication = isDeltaReplication(clustering);
-
+
String ejbModuleName = ejbModule.getName();
URI serviceSpaceName;
try {
@@ -336,7 +338,7 @@
AssertionError error = new AssertionError("contextPath [" + ejbModuleName + "] cannot be parsed as an URI.");
throw (AssertionError) error.initCause(e);
}
-
+
WADISessionManagerConfigInfo configInfo = new WADISessionManagerConfigInfo(serviceSpaceName,
sweepInterval,
numPartitions,
@@ -377,7 +379,7 @@
}
return defaultNumPartitions;
}
-
+
protected GerOpenejbClusteringWadiType getWadiClusterConfig(XmlObject container) throws DeploymentException {
XmlObject[] items = container.selectChildren(CLUSTERING_WADI_QNAME_SET);
if (items.length > 1) {
Modified: geronimo/server/trunk/plugins/openejb/openejb-portlets/src/main/java/org/apache/geronimo/console/ejbserver/EjbHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/openejb-portlets/src/main/java/org/apache/geronimo/console/ejbserver/EjbHelper.java?rev=833127&r1=833126&r2=833127&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/openejb-portlets/src/main/java/org/apache/geronimo/console/ejbserver/EjbHelper.java (original)
+++ geronimo/server/trunk/plugins/openejb/openejb-portlets/src/main/java/org/apache/geronimo/console/ejbserver/EjbHelper.java Thu Nov 5 18:59:30 2009
@@ -64,7 +64,7 @@
public class EjbHelper extends BaseRemoteProxy {
private static final Logger log = LoggerFactory.getLogger(EjbHelper.class);
-
+
private static final String POOLSIZE = "PoolSize";
private static final String BULKPASSIVATE = "BulkPassivate";
private static final String CAPACITY = "Capacity";
@@ -98,7 +98,7 @@
private static final String CI_KEY="portlet.openejb.view.containerid";
private static final String CD_KEY="portlet.openejb.view.containerdescription";
private static final String DN_KEY="portlet.openejb.view.displayname";
-
+
private ContainerSystem containerSystem;
private OpenEjbConfiguration configuration;
private Kernel kernel;
@@ -172,12 +172,12 @@
}
return deployments;
}
-
+
@RemoteMethod
public String getCurrentContainerProperty(String containerId, String propertyKey){
ContainerSystemInfo systemInfo = configuration.containerSystem;
- List<ContainerInfo> containerInfos = systemInfo.containers;
-
+ List<ContainerInfo> containerInfos = systemInfo.containers;
+
for (ContainerInfo containerInfo : containerInfos) {
containerId = replaceEscapes(containerId);
if (containerInfo.id.equals(containerId)) {
@@ -189,7 +189,7 @@
@RemoteMethod
public List<EjbInformation> getContainerInfo(String containerId, HttpServletRequest request) {
- containerId = replaceEscapes(containerId);
+ containerId = replaceEscapes(containerId);
Container container = containerSystem.getContainer(containerId);
if (container == null)
return null;
@@ -236,7 +236,7 @@
editableProperties.add(ACCESSTIMEOUT);
editableProperties.add(CAPACITY);
editableProperties.add(STRICTPOOLING);
- editableProperties.add(INSTANCELIMIT);
+ editableProperties.add(INSTANCELIMIT);
for (Map.Entry entry : containerInfo.properties.entrySet()) {
information = new EjbInformation();
@@ -280,17 +280,17 @@
String propertyValue, HttpServletRequest request) {
propertyKey = propertyKey.trim();
propertyValue = propertyValue.trim();
-
+
containerId = replaceEscapes(containerId);
-
+
List<String> numericProperties = new ArrayList<String>();
numericProperties.add(POOLSIZE);
numericProperties.add(BULKPASSIVATE);
numericProperties.add(TIMEOUT);
- numericProperties.add(INSTANCELIMIT);
+ numericProperties.add(INSTANCELIMIT);
numericProperties.add(CAPACITY);
numericProperties.add(ACCESSTIMEOUT);
-
+
if (numericProperties.contains(propertyKey)) {
try {
Integer.parseInt(propertyValue);
@@ -301,7 +301,7 @@
if (!propertyValue.equalsIgnoreCase(TRUE)
&& !propertyValue.equalsIgnoreCase(FALSE)) {
return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.boolean", propertyKey), null);
- }
+ }
} else {
try {
EjbHelper.class.getClassLoader().loadClass(propertyValue);
@@ -338,7 +338,7 @@
String id = (String) kernel.getAttribute(absName, "id");
if (containerId.equals(id)) {
GBeanData gData1 = kernel.getGBeanData(absName);
- ManageableAttributeStore attributeStore = kernel.getGBean(ManageableAttributeStore.class);
+ ManageableAttributeStore attributeStore = kernel.getGBean(ManageableAttributeStore.class);
GBeanData gData = getGBeanDataFromConfiguration(absName);
for(String attributeName : gData.getAttributeNames()){
if(attributeName.equalsIgnoreCase(propertyKey)){
@@ -347,29 +347,34 @@
Properties gbeanProps = (Properties)gData1.getAttribute("properties");
gbeanProps.setProperty(propertyKey, propertyValue);
GAttributeInfo gAttributeInfo = gData.getGBeanInfo().getAttribute(attributeName);
- attributeStore.setValue(absName.getArtifact(), absName, gAttributeInfo, propertyValue, Thread.currentThread().getContextClassLoader());
+// TODO: This needs to be solved and re-enabled.
+// attributeStore.setValue(absName.getArtifact(), absName, gAttributeInfo, propertyValue, Thread.currentThread().getContextClassLoader());
}
}
}
} catch (GBeanNotFoundException e) {
- return new JSCommonMessage(CommonMessage.Type.Error,
+ return new JSCommonMessage(CommonMessage.Type.Error,
getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
} catch (NoSuchAttributeException e) {
- return new JSCommonMessage(CommonMessage.Type.Error,
+ return new JSCommonMessage(CommonMessage.Type.Error,
getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
} catch (Exception e) {
- return new JSCommonMessage(CommonMessage.Type.Error,
+ return new JSCommonMessage(CommonMessage.Type.Error,
getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
}
}
}
return new JSCommonMessage(CommonMessage.Type.Warn, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.restart"), null);
}
-
+
private GBeanData getGBeanDataFromConfiguration(AbstractName absName){
- Configuration configuration = ConfigurationUtil.getConfigurationManager(kernel).getConfiguration(absName.getArtifact());
- GBeanData gData = configuration.getGBeans().get(absName);
- return gData;
+ try {
+ Configuration configuration = ConfigurationUtil.getConfigurationManager(kernel).getConfiguration(absName.getArtifact());
+ GBeanData gData = configuration.getGBeans().get(absName);
+ return gData;
+ } catch (GBeanNotFoundException e) {
+ return null;
+ }
}
@RemoteMethod
public List<EjbInformation> getDeploymentInfo(String containerId,
@@ -379,7 +384,7 @@
.getDeploymentInfo(deploymentId);
List<EjbInformation> informations = new ArrayList<EjbInformation>();
EjbInformation information = new EjbInformation();
- information.setName(getLocalizedString(request, BUNDLE_NAME, BEANCLASSNAME_KEY));
+ information.setName(getLocalizedString(request, BUNDLE_NAME, BEANCLASSNAME_KEY));
information.setValue(deploymentInfo.getBeanClass().getName());
informations.add(information);
@@ -534,11 +539,11 @@
}
return data;
}
-
+
private String replaceEscapes(String escaped){
if (escaped.indexOf("%20") != -1) {
return escaped.replaceAll("%20"," ");
- }
+ }
return escaped;
}