[jboss-cvs] JBossAS SVN: r84175 - in trunk: connector/src/main/org/jboss/resource/deployment and 17 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 13 10:14:49 EST 2009
Author: adrian at jboss.org
Date: 2009-02-13 10:14:49 -0500 (Fri, 13 Feb 2009)
New Revision: 84175
Removed:
trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java
trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberServiceMBean.java
trunk/connector/src/main/org/jboss/resource/deployment/RARDeployer.java
trunk/connector/src/main/org/jboss/resource/deployment/RARDeployerMBean.java
trunk/connector/src/main/org/jboss/resource/deployment/RARDeployment.java
trunk/spring-int/src/main/org/jboss/spring/deployment/
trunk/spring-int/src/main/org/jboss/spring/kernel/MicrocontainerLoaderImpl.java
trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployer.java
trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployerMBean.java
trunk/spring-int/src/main/org/jboss/spring/loader/
trunk/system-jmx/src/main/org/jboss/deployment/DefaultDeploymentSorter.java
trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfo.java
trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfoComparator.java
trunk/system-jmx/src/main/org/jboss/deployment/DeploymentSorter.java
trunk/system-jmx/src/main/org/jboss/deployment/JARDeployer.java
trunk/system-jmx/src/main/org/jboss/deployment/JARDeployerMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/ObjectModelFactorySimpleSubDeployerSupport.java
trunk/system-jmx/src/main/org/jboss/deployment/SARDeployer.java
trunk/system-jmx/src/main/org/jboss/deployment/SARDeployerMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/SchemaBindingSimpleSubDeployerSupport.java
trunk/system-jmx/src/main/org/jboss/deployment/SchemaResolverSimpleSubDeployerSupport.java
trunk/system-jmx/src/main/org/jboss/deployment/SerializableDeploymentInfo.java
trunk/system-jmx/src/main/org/jboss/deployment/SimpleSubDeployerSupport.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployer.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExt.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExtMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptor.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorSupport.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerSupport.java
trunk/system-jmx/src/main/org/jboss/deployment/SuffixOrderHelper.java
trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployer.java
trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployerMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/scanner/
trunk/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java
trunk/testsuite/src/main/org/jboss/test/jmx/deployer/
trunk/testsuite/src/main/org/jboss/test/jmx/test/AbstractURLDeploymentScannerTest.java
trunk/testsuite/src/main/org/jboss/test/jmx/test/JBAS3050URLDeploymentScannerUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/jmx/test/SimpleURLDeploymentScannerUnitTestCase.java
trunk/varia/src/main/org/jboss/kernel/
trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployer.java
trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployerMBean.java
trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployer.java
trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployerMBean.java
trunk/varia/src/main/org/jboss/varia/deployment/convertor/Convertor.java
trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertor.java
trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertorMBean.java
Modified:
trunk/management/src/main/org/jboss/management/j2ee/LocalJBossServerDomain.java
trunk/management/src/main/org/jboss/management/j2ee/factory/DefaultManagedObjectFactoryMap.java
trunk/management/src/main/org/jboss/management/j2ee/factory/EARModuleFactory.java
trunk/management/src/main/org/jboss/management/j2ee/factory/EJBModuleFactory.java
trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java
trunk/management/src/main/org/jboss/management/j2ee/factory/JCAResourceFactory.java
trunk/management/src/main/org/jboss/management/j2ee/factory/RARModuleFactory.java
trunk/management/src/main/org/jboss/management/j2ee/factory/ServiceModuleFactory.java
trunk/management/src/main/org/jboss/management/j2ee/factory/WebModuleFactory.java
trunk/server/src/main/org/jboss/deployment/EARDeployerMBean.java
trunk/server/src/main/org/jboss/ejb/Container.java
trunk/server/src/main/org/jboss/ejb/EJBDeployerMBean.java
trunk/server/src/main/org/jboss/ejb/EjbModule.java
trunk/server/src/main/org/jboss/web/AbstractWebContainerMBean.java
trunk/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java
trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java
trunk/system-jmx/src/main/org/jboss/deployment/MainDeployerMBean.java
trunk/system-jmx/src/main/org/jboss/system/ServiceController.java
trunk/system-jmx/src/main/org/jboss/system/ServiceControllerMBean.java
trunk/system-jmx/src/main/org/jboss/system/ServiceMBeanSupport.java
trunk/system-jmx/src/tests/org/jboss/test/system/controller/legacy/OldServiceController.java
trunk/varia/src/main/org/jboss/services/deployment/DeploymentManager.java
trunk/varia/src/main/org/jboss/varia/deployment/BeanShellScript.java
Log:
[JBAS-6503] - Remove the old deployer api
Deleted: trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberService.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,506 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.server;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.deployment.Deployer;
-import org.jboss.deployment.scanner.URLDeploymentScanner;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.system.server.ServerConfigLocator;
-
-/**
- *
- * @author <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- *
- * <p><b>20021014 andreas schaefer:</b>
- * <ul>
- * <li>Initial import
- * </ul>
- * <p><b>20020809 bill burke:</b>
- * <ul>
- * <li>Rewrote as a Scanner instead. Also on boot-up asks cluster for deployable files
- * </ul>
- */
-public class FarmMemberService extends URLDeploymentScanner implements FarmMemberServiceMBean
-{
- protected HAPartition mClusterPartition = null;
- private File mTempDirectory;
- private ClusterFileTransfer mFileTransfer;
-
- protected final static String SERVICE_NAME = "FarmMemberService";
- protected HashMap parentDUMap = new HashMap();
-
- protected ArrayList remotelyDeployed = new ArrayList ();
- protected ArrayList remotelyUndeployed = new ArrayList ();
-
- public String getPartitionName()
- {
- return mClusterPartition.getPartitionName();
- }
-
- public HAPartition getHAPartition()
- {
- return mClusterPartition;
- }
-
- public void setHAPartition(HAPartition clusterPartition)
- {
- if( ( getState () != STARTED ) && ( getState () != STARTING ) )
- {
- this.mClusterPartition = clusterPartition;
- }
- }
-
- /** Backward compatibility, mapped to the URLs attribute of URLDeploymentScannerMBean
- * @deprecated
- */
- public void setFarmDeployDirectory(String urls)
- throws MalformedURLException
- {
- super.setURLs(urls);
- }
-
- /** Backward compatibility, but ignored as it does nothing.
- * @deprecated
- */
- public void setScannerName(String name)
- {
- log.warn("ScannerName does nothing");
- }
-
- // Service implementation ----------------------------------------
-
- public String getName()
- {
- return "Farm Member Service";
- }
-
- /**
- * Looks up the Server Config instance to figure out the
- * temp-directory and the farm-deploy-directory
- **/
- protected void createService() throws Exception
- {
- super.createService();
- ServerConfig lConfig = ServerConfigLocator.locate();
- mTempDirectory = lConfig.getServerTempDir();
-
- createUnexistingLocalDir ();
- }
- /**
- * Register itself as RPC-Handler to the HA-Partition
- * and add the farm deployment directory to the scanner
- **/
- protected void startService()
- throws Exception
- {
- try
- {
- if (mClusterPartition == null)
- {
- throw new IllegalStateException("HAPartition property must be set before starting FarmMember service");
- }
-
- log.debug( "registerRPCHandler" );
- mClusterPartition.registerRPCHandler( SERVICE_NAME, this );
-
- mFileTransfer = new ClusterFileTransfer(mClusterPartition, buildParentFolderMapping());
-
- ArrayList response = mClusterPartition.callMethodOnCoordinatorNode(
- SERVICE_NAME,
- "farmDeployments",
- new Object[] {}, new Class[] {},
- true
- );
-
- log.debug("Found "+response.size()+" farmDeployments responses");
- for (int i = 0; i < response.size(); i++)
- {
- Object map = response.get(i);
- if ( map != null && map instanceof HashMap )
- {
- HashMap farmed = (HashMap) map;
- pullNewDeployments(mClusterPartition, farmed);
- }
- }
-
- // scan before we enable the thread, so JBoss version shows up afterwards
- scannerThread.doScan();
-
- // enable scanner thread if we are enabled
- scannerThread.setEnabled(isScanEnabled());
- }
- catch(Exception e)
- {
- this.logException(e);
- throw e;
- }
- }
-
-
- protected void pullNewDeployments(HAPartition partition, HashMap farmed)
- {
- log.info("**** pullNewDeployments ****");
- Iterator it = farmed.keySet().iterator();
- while (it.hasNext())
- {
- String depName = (String)it.next();
- DeployedURL du = (DeployedURL)parentDUMap.get(depName);
- Date last = (Date)farmed.get(depName);
- if (du != null)
- {
- Date theLast = new Date(du.getFile().lastModified());
- if (!theLast.before(last))
- {
- continue;
- }
- }
-
- String parentName = depName.substring(0, depName.indexOf('/'));
- File destFile = new File(depName);
- try
- {
- mFileTransfer.pull(destFile,parentName);
- synchronized (remotelyDeployed)
- {
- remotelyDeployed.add (destFile.getName());
- }
- }
- catch(ClusterFileTransferException e)
- {
- // log the exception and continue with the next deployment
- this.logException(e);
- }
- }
- }
-
- // return mapping of Farming folder names to the File
- private Map buildParentFolderMapping()
- {
- Map map = new HashMap();
- URL[] urls = (URL[]) urlList.toArray( new URL[] {} );
- for (int i = 0; i < urlList.size(); i++)
- {
- if (urls[i].getProtocol().equals("file"))
- {
- File file = new File(urls[i].getFile());
- if (file.isDirectory())
- {
- map.put(file.getName(),file);
- }
-
- }
- }
- return map;
- }
-
- protected File findParent(String parentName)
- {
- URL[] urls = (URL[]) urlList.toArray( new URL[] {} );
- for (int i = 0; i < urlList.size(); i++)
- {
- if (urls[i].getProtocol().equals("file"))
- {
- File file = new File(urls[i].getFile());
- if (file.isDirectory())
- {
- if (file.getName().equals(parentName)) return file;
- }
- }
- }
- return null;
- }
-
- public HashMap farmDeployments()
- {
- log.debug("farmDeployments request, parentDUMap.size="+parentDUMap.size());
- Iterator it = parentDUMap.keySet().iterator();
- HashMap farmed = new HashMap();
- while(it.hasNext())
- {
- String key = (String)it.next();
- DeployedURL du = (DeployedURL)parentDUMap.get(key);
- farmed.put(key, new Date(du.getFile().lastModified()));
- }
- return farmed;
- }
-
- public void farmDeploy( String parentName, File destFile, Date date )
- {
- try
- {
- File parent = findParent(parentName);
- if (parent == null)
- {
- log.info("Could not find parent: " + parentName + " for deployment: " + destFile + ", data: " + date);
- return;
- }
-
- String fullName = parentName + "/" + destFile.getName();
-
- DeployedURL du = null;
- synchronized(parentDUMap)
- {
- du = (DeployedURL)parentDUMap.get(fullName);
- }
- boolean deployIt = false;
- if (du == null)
- {
- deployIt = true;
- }
- else
- {
- Date lastChanged = new Date(du.getFile().lastModified());
- deployIt = lastChanged.before(date);
- }
-
- if (deployIt)
- {
- // we remember this deployment to avoid recursive farm calls!
- //
- synchronized (remotelyDeployed)
- {
- remotelyDeployed.add (fullName);
- }
-
- log.info( "farmDeployment(), deploy locally: " + fullName );
- // Adjust the date and move the file to /farm
- // but delete it first if already there
- File tempFile = new File(this.mTempDirectory, destFile.getName() );
- File lFarmFile = new File(parent,destFile.getName());
- if( lFarmFile.exists() ) {
- if(!lFarmFile.delete()) {
- log.info("could not delete target file for farm deployment "+ lFarmFile.getName());
- }
- }
- tempFile.setLastModified( date.getTime() );
-
- if(! ClusterFileTransfer.localMove(tempFile,lFarmFile ))
- {
- log.info("Could not move "+tempFile+" to " + lFarmFile);
- }
- }
- else
- {
- log.info(fullName + " is already deployed by farm service on this node");
- }
- }
- catch( Exception e ) {
- logException( e );
- }
- }
-
- public void farmUndeploy(String parentName, String fileName)
- {
- try {
- // First check if file is already deployed
- log.info( "doUndeployment(), File: " + parentName + "/" + fileName);
- File parent = findParent(parentName);
- if (parent == null)
- {
- log.info("Could not find parent: " + parentName + " for undeployment: " + fileName);
- return;
- }
- File deployed = new File(parent, fileName);
- if (deployed.exists())
- {
- // we remember this undeployment to avoid recursive farm calls!
- //
- synchronized (remotelyUndeployed)
- {
- String fullName = parentName + "/" + fileName;
- remotelyUndeployed.add (fullName);
- }
-
- if(deployed.delete())
- log.info( "farmUndeployment(), removed file " + deployed );
- else
- log.info( "farmUndeployment(), could not remove file " + deployed );
- }
- }
- catch( Exception e ) {
- logException( e );
- }
- }
-
- protected void deploy(final DeployedURL du)
- {
- super.deploy(du);
- File file = du.getFile();
- File parent = file.getParentFile();
- if (parent == null) return;
-
- String fullName = parent.getName() + "/" + file.getName();
- synchronized (parentDUMap)
- {
- parentDUMap.put(fullName, du);
- }
-
- try
- {
- // We check if we must do a remote call or not; maybe the deploy
- // is already the consequence of a farm call! (avoid recursivity!)
- //
- boolean consequenceOfRemoteCall = false;
- synchronized (remotelyDeployed)
- {
- consequenceOfRemoteCall = remotelyDeployed.remove (fullName);
- }
-
- if (getState() == STARTING) return;
-
- if (!consequenceOfRemoteCall)
- {
- Date fileDate = new Date(file.lastModified());
-
- this.mFileTransfer.push(file, parent.getName(), true);
-
- mClusterPartition.callMethodOnCluster(
- SERVICE_NAME,
- "farmDeploy",
- new Object[] {parent.getName(), file, fileDate},
- new Class[] {String.class, File.class, Date.class},
- true
- );
- }
- }
- catch (ClusterFileTransferException e)
- {
- logException(e);
- }
- catch (Exception ex)
- {
- logException(ex);
- }
-
- }
-
- protected void undeploy(final DeployedURL du)
- {
-
- File file = du.getFile();
- File parent = file.getParentFile();
- String parentName = parent.getName();
- String fileName = file.getName();
- super.undeploy(du);
-
- String fullName = parent.getName() + "/" + file.getName();
- synchronized (parentDUMap)
- {
- parentDUMap.remove(fullName);
- }
-
- if (getState() == STOPPING) return;
-
- try
- {
- // We check if we must do a remote call or not: maybe the undeploy
- // is already the consequence of a farm call! (avoid recusivity!)
- //
- boolean consequenceOfRemoteCall = false;
- synchronized (remotelyUndeployed)
- {
- consequenceOfRemoteCall = remotelyUndeployed.remove (fullName);
- }
-
- if (!consequenceOfRemoteCall)
- {
- mClusterPartition.callMethodOnCluster(
- SERVICE_NAME,
- "farmUndeploy",
- new Object[] {parentName, fileName},
- new Class[] {String.class, String.class},
- true
- );
- }
- }
- catch (Exception ex)
- {
- logException(ex);
- }
- }
-
- /**
- * Go through the myriad of nested JMX exceptions to pull out the true
- * exception if possible and log it.
- *
- * @param e The exception to be logged.
- */
- private void logException( Throwable e )
- {
- if (e instanceof javax.management.RuntimeErrorException)
- {
- e = ((javax.management.RuntimeErrorException)e).getTargetError();
- }
- else if (e instanceof javax.management.RuntimeMBeanException)
- {
- e = ((javax.management.RuntimeMBeanException)e).getTargetException();
- }
- else if (e instanceof javax.management.RuntimeOperationsException)
- {
- e = ((javax.management.RuntimeOperationsException)e).getTargetException();
- }
- else if (e instanceof javax.management.MBeanException)
- {
- e = ((javax.management.MBeanException)e).getTargetException();
- }
- else if (e instanceof javax.management.ReflectionException)
- {
- e = ((javax.management.ReflectionException)e).getTargetException();
- }
-
- log.error(e);
- }
-
- protected void createUnexistingLocalDir()
- {
- if (this.urlList != null)
- {
- Iterator iter = this.urlList.iterator ();
- while (iter.hasNext ())
- {
- URL url = null;
- try
- {
- url = (URL)iter.next ();
- if (url.getProtocol().equals("file"))
- {
- File targetDir = new File (url.getFile ());
- if (!targetDir.exists ())
- targetDir.mkdirs ();
- }
- }
- catch (Exception e)
- {
- log.info ("Problem while creating a farm directory: " + url, e);
- }
- }
- }
- }
-}
Deleted: trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberServiceMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberServiceMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/FarmMemberServiceMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.server;
-
-import javax.management.ObjectName;
-
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * MBean interface for FarmMemberService
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- *
- * <p><b>20020809 bill burke:</b>
- * <ul>
- * <li>Initial import
- * </ul>
- */
-public interface FarmMemberServiceMBean
-{
- /** The default object name. */
- ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss:service=FarmMember");
-
- /**
- * Gets the name of the partition used by this service. This is a
- * convenience method as the partition name is an attribute of HAPartition.
- *
- * @return the name of the partition
- */
- String getPartitionName();
-
- /**
- * Get the underlying partition used by this service.
- *
- * @return the partition
- */
- HAPartition getHAPartition();
-
- /**
- * Sets the underlying partition used by this service.
- * Can be set only when the MBean is not in a STARTED or STARTING state.
- *
- * @param clusterPartition the partition
- */
- void setHAPartition(HAPartition clusterPartition);
-}
Deleted: trunk/connector/src/main/org/jboss/resource/deployment/RARDeployer.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployment/RARDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/connector/src/main/org/jboss/resource/deployment/RARDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,180 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.resource.deployment;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.management.ObjectName;
-import javax.resource.spi.XATerminator;
-import javax.resource.spi.work.WorkManager;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.ObjectModelFactorySimpleSubDeployerSupport;
-import org.jboss.resource.metadata.ConnectorMetaData;
-import org.jboss.resource.metadata.JBossRAMetaData;
-import org.jboss.resource.metadata.RARDeploymentMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-/**
- * A resource adapter deployer
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="weston.price at jboss.com">Weston Price</a>
- * @version $Revision$
- */
-public class RARDeployer extends ObjectModelFactorySimpleSubDeployerSupport
- implements RARDeployerMBean
-{
-
- /** The JBOSS_RA_XML */
- private static final String JBOSS_RA_XML = "META-INF/jboss-ra.xml";
-
- /** The work manager name */
- protected ObjectName workManagerName;
-
- /** The work manager */
- protected WorkManager workManager;
-
- /** The xa terminator */
- protected XATerminator xaTerminator;
-
- /** The xa terminator name */
- protected ObjectName xaTerminatorName;
-
- public RARDeployer()
- {
- setEnhancedSuffixes(new String[] { "250:.rar" });
- }
-
- @SuppressWarnings("deprecation")
- protected void parseMetaData(DeploymentInfo di, URL url) throws org.jboss.deployment.DeploymentException
- {
- super.parseMetaData(di, url);
-
- InputStream is = di.localCl.getResourceAsStream(JBOSS_RA_XML);
- RARDeploymentMetaData rdmd = new RARDeploymentMetaData();
- rdmd.setConnectorMetaData((ConnectorMetaData)di.metaData);
- di.metaData = rdmd;
-
- try
- {
- if(is != null)
- {
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = getExtendedObjectModelFactory();
- JBossRAMetaData ramd = (JBossRAMetaData)unmarshaller.unmarshal(is, factory, (Object)null);
- rdmd.setRaXmlMetaData(ramd);
-
- }
-
- }
-
- catch (Throwable t)
- {
-
- org.jboss.deployment.DeploymentException.rethrowAsDeploymentException("Error parsing meta data " + url, t);
-
- }finally
- {
- try
- {
- if(is != null)
- {
- is.close();
- }
- }
- catch (IOException e)
- {
- }
- }
-
-
- }
- public String getExtension()
- {
- return ".rar";
- }
-
- public String getMetaDataURL()
- {
- return "META-INF/ra.xml";
- }
-
- public String getObjectName(DeploymentInfo di) throws org.jboss.deployment.DeploymentException
- {
- String name = di.shortName;
- di = di.parent;
- while (di != null)
- {
- name = di.shortName + "#" + name;
- di = di.parent;
- }
- return "jboss.jca:service=RARDeployment,name='" + name + "'";
- }
-
- public String getDeploymentClass()
- {
- return RARDeployment.class.getName();
- }
-
- public ObjectModelFactory getObjectModelFactory()
- {
- return new ResourceAdapterObjectModelFactory();
- }
-
- public ObjectName getWorkManagerName()
- {
- return workManagerName;
- }
-
- public void setWorkManagerName(ObjectName workManagerName)
- {
- this.workManagerName = workManagerName;
- }
-
- public ObjectName getXATerminatorName()
- {
- return xaTerminatorName;
- }
-
- public void setXATerminatorName(ObjectName xaTerminatorName)
- {
- this.xaTerminatorName = xaTerminatorName;
- }
-
- protected void startService() throws Exception
- {
- workManager = (WorkManager) server.getAttribute(workManagerName, "Instance");
- xaTerminator = (XATerminator) server.getAttribute(xaTerminatorName, "XATerminator");
- super.startService();
- }
-
- private ObjectModelFactory getExtendedObjectModelFactory()
- {
- return new JBossRAObjectModelFactory();
- }
-}
Deleted: trunk/connector/src/main/org/jboss/resource/deployment/RARDeployerMBean.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployment/RARDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/connector/src/main/org/jboss/resource/deployment/RARDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.resource.deployment;
-
-import javax.management.ObjectName;
-
-import org.jboss.deployment.SubDeployerExtMBean;
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * MBean interface.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public interface RARDeployerMBean extends SubDeployerExtMBean
-{
- /** The default ObjectName */
- static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.jca:service=RARDeployer");
-
- /**
- * Get the work manager name
- *
- * @return the work manager name
- */
- ObjectName getWorkManagerName();
-
- /**
- * Set the thread pool name
- *
- * @param workManagerName the work manager name
- */
- void setWorkManagerName(ObjectName workManagerName);
-
- /**
- * Get the XATerminator
- *
- * @return the xa terminator
- */
- ObjectName getXATerminatorName();
-
- /**
- * Set the xa terminator
- *
- * @param xaTerminatorName name the xa terminator name
- */
- void setXATerminatorName(ObjectName xaTerminatorName);
-}
Deleted: trunk/connector/src/main/org/jboss/resource/deployment/RARDeployment.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployment/RARDeployment.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/connector/src/main/org/jboss/resource/deployment/RARDeployment.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,305 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.resource.deployment;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Timer;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanParameterInfo;
-import javax.management.ReflectionException;
-import javax.resource.spi.ActivationSpec;
-import javax.resource.spi.BootstrapContext;
-import javax.resource.spi.ResourceAdapter;
-import javax.resource.spi.UnavailableException;
-import javax.resource.spi.XATerminator;
-import javax.resource.spi.endpoint.MessageEndpointFactory;
-import javax.resource.spi.work.WorkManager;
-
-import org.jboss.bootstrap.spi.util.ServerConfigUtil;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.resource.metadata.ConfigPropertyMetaData;
-import org.jboss.resource.metadata.ConnectorMetaData;
-import org.jboss.resource.metadata.DescriptionGroupMetaData;
-import org.jboss.resource.metadata.JBossRAMetaData;
-import org.jboss.resource.metadata.MessageListenerMetaData;
-import org.jboss.resource.metadata.RARDeploymentMetaData;
-import org.jboss.system.ServiceDynamicMBeanSupport;
-
-/**
- * A resource adapter deployment
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class RARDeployment extends ServiceDynamicMBeanSupport
- implements BootstrapContext
-{
- /** The deployment info */
- protected DeploymentInfo di;
-
- /** Our deployer */
- protected RARDeployer deployer;
-
- /** The RARDeploymentMetaData */
- protected RARDeploymentMetaData rdmd;
-
- /** The ConnectorMetaData */
- protected ConnectorMetaData cmd;
-
- /** The JBossRAMetaData */
- protected JBossRAMetaData ramd;
-
- /** The resource adapter */
- protected ResourceAdapter resourceAdapter;
-
- /**
- * Create a new RAR deployment
- *
- * @param di the deployment info
- */
- public RARDeployment(DeploymentInfo di)
- {
- this.di = di;
- this.deployer = (RARDeployer) di.deployer;
- this.rdmd = (RARDeploymentMetaData)di.metaData;
- this.cmd = rdmd.getConnectorMetaData();
- this.ramd = rdmd.getRaXmlMetaData();
-
- }
-
- // Public --------------------------------------------------------
-
- public Timer createTimer() throws UnavailableException
- {
- return new Timer(true);
- }
-
- public WorkManager getWorkManager()
- {
- return deployer.workManager;
- }
-
- public XATerminator getXATerminator()
- {
- return deployer.xaTerminator;
- }
-
- protected void startService() throws Exception
- {
- if (cmd.getLicense().getRequired())
- {
- log.info("Required license terms exist, view META-INF/ra.xml in " + ServerConfigUtil.shortUrlFromServerHome(di.url.toString()));
- log.debug("License terms full URL: " + di.url);
- }
- resourceAdapter = ResourceAdapterFactory.createResourceAdapter(rdmd);
- resourceAdapter.start(this);
- }
-
- protected void stopService() throws Exception
- {
- resourceAdapter.stop();
- }
-
- protected String getInternalDescription()
- {
- String description = null;
- DescriptionGroupMetaData dgmd = cmd.getDescription();
- if (dgmd != null)
- description = dgmd.getDescription();
- if (description == null)
- description = "RAR Deployment " + di.url;
- return description;
- }
-
- protected MBeanAttributeInfo[] getInternalAttributeInfo()
- {
- Collection properties = cmd.getProperties();
- MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[11+properties.size()];
- attrs[0] = new MBeanAttributeInfo("MetaData", ConnectorMetaData.class.getName(), "The meta data", true, false, false);
- attrs[1] = new MBeanAttributeInfo("AuthenticationMechanism", String.class.getName(), "The authentication mechanism", true, false, false);
- attrs[2] = new MBeanAttributeInfo("EISType", String.class.getName(), "The EIS type", true, false, false);
- attrs[3] = new MBeanAttributeInfo("License", String.class.getName(), "The license", true, false, false);
- attrs[4] = new MBeanAttributeInfo("RAClass", String.class.getName(), "The resource adapter class", true, false, false);
- attrs[5] = new MBeanAttributeInfo("RAVersion", String.class.getName(), "The resource adapter version", true, false, false);
- attrs[6] = new MBeanAttributeInfo("TransactionSupport", String.class.getName(), "The transaction support", true, false, false);
- attrs[7] = new MBeanAttributeInfo("VendorName", String.class.getName(), "The vendor name", true, false, false);
- attrs[8] = new MBeanAttributeInfo("Version", String.class.getName(), "The spec version", true, false, false);
- attrs[9] = new MBeanAttributeInfo("ReauthenticationSupport", Boolean.TYPE.getName(), "Whether reauthentication support is supported", true, false, false);
- attrs[10] = new MBeanAttributeInfo("ResourceAdapter", ResourceAdapter.class.getName(), "The resource adapter instance", true, false, false);
- int n = 11;
- for (Iterator i = properties.iterator(); i.hasNext();)
- {
- ConfigPropertyMetaData cpmd = (ConfigPropertyMetaData) i.next();
- attrs[n++] = new MBeanAttributeInfo(cpmd.getName(), cpmd.getType(), cpmd.getDescription().getDescription(), true, false, false);
- }
- return attrs;
- }
-
- protected Object getInternalAttribute(String attribute)
- throws AttributeNotFoundException, MBeanException, ReflectionException
- {
- if ("MetaData".equals(attribute))
- return cmd;
- else if ("AuthenticationMechanism".equals(attribute))
- return cmd.getAuthenticationMechanism().getAuthenticationMechansimType();
- else if ("EISType".equals(attribute))
- return cmd.getEISType();
- else if ("License".equals(attribute))
- return cmd.getLicense().getDescription().getDescription();
- else if ("RAClass".equals(attribute))
- return cmd.getRAClass();
- else if ("RAVersion".equals(attribute))
- return cmd.getRAVersion();
- else if ("TransactionSupport".equals(attribute))
- return cmd.getTransactionSupport();
- else if ("VendorName".equals(attribute))
- return cmd.getVendorName();
- else if ("Version".equals(attribute))
- return cmd.getVersion();
- else if ("ReauthenticationSupport".equals(attribute))
- return new Boolean(cmd.getReauthenticationSupport());
- else if ("ResourceAdapter".equals(attribute))
- return resourceAdapter;
- Object property = cmd.getProperty(attribute);
- if (property != null)
- return property;
-
- return super.getInternalAttribute(attribute);
- }
-
- protected MBeanOperationInfo[] getInternalOperationInfo()
- {
- MBeanOperationInfo[] ops = new MBeanOperationInfo[3];
-
- MBeanParameterInfo[] createActivationSpecParams = new MBeanParameterInfo[]
- {
- new MBeanParameterInfo("MessagingType", Class.class.getName(), "The type of the message listener"),
- new MBeanParameterInfo("ActivationConfig", Collection.class.getName(), "A collection of activation config properties")
- };
- ops[0] = new MBeanOperationInfo("createActivationSpec", "Create an activation spec",
- createActivationSpecParams, ActivationSpec.class.getName(), MBeanOperationInfo.ACTION);
-
- MBeanParameterInfo[] activationParams = new MBeanParameterInfo[]
- {
- new MBeanParameterInfo("MessageEndpointFactory", MessageEndpointFactory.class.getName(), "The message endpoint factory"),
- new MBeanParameterInfo("ActivationSpec", ActivationSpec.class.getName(), "The activation spec")
- };
- ops[1] = new MBeanOperationInfo("endpointActivation", "Active the endpoint",
- activationParams, Void.class.getName(), MBeanOperationInfo.ACTION);
- ops[2] = new MBeanOperationInfo("endpointDeactivation", "Deactive the endpoint",
- activationParams, Void.class.getName(), MBeanOperationInfo.ACTION);
-
- return ops;
- }
-
- protected Object internalInvoke(String actionName, Object[] params, String[] signature) throws MBeanException,
- ReflectionException
- {
- if ("createActivationSpec".equals(actionName))
- {
- if (params.length != 2)
- throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
- Class messagingType = (Class) params[0];
- Collection activationConfig = (Collection) params[1];
- return createActivationSpec(messagingType, activationConfig);
- }
- else if ("endpointActivation".equals(actionName))
- {
- if (params.length != 2)
- throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
- MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory) params[0];
- ActivationSpec activationSpec = (ActivationSpec) params[1];
- endpointActivation(messageEndpointFactory, activationSpec);
- return null;
- }
- else if ("endpointDeactivation".equals(actionName))
- {
- if (params.length != 2)
- throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
- MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory) params[0];
- ActivationSpec activationSpec = (ActivationSpec) params[1];
- endpointDeactivation(messageEndpointFactory, activationSpec);
- return null;
- }
- return super.internalInvoke(actionName, params, signature);
- }
-
- protected ActivationSpec createActivationSpec(Class messagingType, Collection activationConfig) throws MBeanException
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace("CreateActivateSpec rar=" + getServiceName() + " messagingType=" + messagingType.getName() + " activationConfig=" + activationConfig);
-
- try
- {
- // Find the meta data
- MessageListenerMetaData mlmd = cmd.getMessageListener(messagingType.getName());
- if (mlmd == null)
- throw new DeploymentException("MessagingType '" + messagingType.getName() + "' not found in resource deployment " + getServiceName());
-
- return ActivationSpecFactory.createActivationSpec(getServiceName(), messagingType.getName(), activationConfig, mlmd);
- }
- catch (Exception e)
- {
- throw new MBeanException(e, "Error in create activation spec " + getServiceName());
- }
- }
-
- protected void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws MBeanException
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace("EndpointActivation rar=" + getServiceName() + " messagingEndpointFactory=" + messageEndpointFactory + " activationSpec=" + activationSpec);
-
- try
- {
- activationSpec.setResourceAdapter(resourceAdapter);
- resourceAdapter.endpointActivation(messageEndpointFactory, activationSpec);
- }
- catch (Exception e)
- {
- throw new MBeanException(e, "Error in endpoint activation " + getServiceName());
- }
- }
-
- protected void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws MBeanException
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace("EndpointDeactivation rar=" + getServiceName() + " messagingEndpointFactory=" + messageEndpointFactory + " activationSpec=" + activationSpec);
-
- try
- {
- resourceAdapter.endpointDeactivation(messageEndpointFactory, activationSpec);
- }
- catch (Exception e)
- {
- throw new MBeanException(e, "Error in endpoint deactivation " + getServiceName());
- }
- }
-}
Modified: trunk/management/src/main/org/jboss/management/j2ee/LocalJBossServerDomain.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/LocalJBossServerDomain.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/LocalJBossServerDomain.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,9 +21,19 @@
*/
package org.jboss.management.j2ee;
-import org.jboss.deployment.DeploymentInfo;
+import java.net.InetAddress;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.JMException;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+
import org.jboss.deployment.MainDeployerConstants;
-import org.jboss.deployment.SubDeployer;
import org.jboss.logging.Logger;
import org.jboss.management.j2ee.factory.DefaultManagedObjectFactoryMap;
import org.jboss.management.j2ee.factory.ManagedObjectFactory;
@@ -32,17 +42,6 @@
import org.jboss.system.ServiceMBean;
import org.jboss.system.ServiceMBeanSupport;
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import java.net.InetAddress;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
/**
* The integration MBean for the local JBoss server management domain. This
* bridges between the core JBoss JSR-77 agnostic code to the JSR-77
@@ -468,33 +467,6 @@
factory.destroy(mbeanServer, userData);
}
}
- else if (type.equals(SubDeployer.START_NOTIFICATION))
- {
- ManagedObjectFactory factory = managedObjFactoryMap.getFactory(msg);
- if (factory != null)
- {
- factory.create(mbeanServer, userData);
- }
- }
- else if (type.equals(SubDeployer.DESTROY_NOTIFICATION))
- {
- ManagedObjectFactory factory = managedObjFactoryMap.getFactory(msg);
- if (factory != null)
- {
- DeploymentInfo di = (DeploymentInfo) msg.getUserData();
- factory.destroy(mbeanServer, di);
- }
- }
- else if (type.equals(MainDeployerConstants.ADD_DEPLOYER))
- {
- ObjectName deployerName = (ObjectName) msg.getUserData();
- registerWithDeployer(deployerName);
- }
- else if (type.equals(MainDeployerConstants.REMOVE_DEPLOYER))
- {
- ObjectName deployerName = (ObjectName) msg.getUserData();
- unregisterWithDeployer(deployerName);
- }
}
catch (Throwable t)
{
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/DefaultManagedObjectFactoryMap.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/DefaultManagedObjectFactoryMap.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/DefaultManagedObjectFactoryMap.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,15 +21,15 @@
*/
package org.jboss.management.j2ee.factory;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.ObjectNameMatch;
+import java.util.HashMap;
+import java.util.Iterator;
import javax.management.Notification;
import javax.management.ObjectName;
-import java.util.HashMap;
-import java.util.Iterator;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.ObjectNameMatch;
+
/**
* @author Scott.Stark at jboss.org
* @version $Revision$
@@ -61,11 +61,6 @@
{
senderName = (ObjectName) data;
}
- else if (data instanceof DeploymentInfo)
- {
- DeploymentInfo di = (DeploymentInfo) data;
- senderName = di.deployer.getServiceName();
- }
factory = (ManagedObjectFactory) factoryMap.get(senderName);
if (factory == null)
{
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/EARModuleFactory.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/EARModuleFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/EARModuleFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,13 +21,8 @@
*/
package org.jboss.management.j2ee.factory;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.management.j2ee.J2EEApplication;
-
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import java.util.HashMap;
/**
* A factory for mapping EARDeployer deployments to J2EEApplications
@@ -38,10 +33,6 @@
public class EARModuleFactory
implements ManagedObjectFactory
{
- private static Logger log = Logger.getLogger(EARModuleFactory.class);
-
- private HashMap deploymentToModuleNameMap = new HashMap();
-
/**
* Create JSR-77 J2EEApplication
*
@@ -50,19 +41,7 @@
*/
public ObjectName create(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return null;
-
- DeploymentInfo di = (DeploymentInfo) data;
- String moduleName = di.shortName;
- ObjectName jsr77Name = J2EEApplication.create(server, moduleName, di.localUrl);
- deploymentToModuleNameMap.put(di, jsr77Name);
- if (jsr77Name != null)
- {
- log.debug("Created J2EEApplication: " + jsr77Name);
- }
-
- return jsr77Name;
+ return null;
}
/**
@@ -73,16 +52,6 @@
*/
public void destroy(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return;
-
- DeploymentInfo di = (DeploymentInfo) data;
- ObjectName jsr77Name = (ObjectName) deploymentToModuleNameMap.remove(di);
- // Remove JSR-77 EAR-Module
- if (jsr77Name != null)
- {
- J2EEApplication.destroy(server, jsr77Name);
- log.debug("Removed J2EEApplication: " + jsr77Name);
- }
+ return;
}
}
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/EJBModuleFactory.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/EJBModuleFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/EJBModuleFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,17 +21,14 @@
*/
package org.jboss.management.j2ee.factory;
-import java.util.Iterator;
import java.util.Map;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.ejb.EjbModule;
import org.jboss.logging.Logger;
import org.jboss.management.j2ee.EJB;
-import org.jboss.management.j2ee.EJBModule;
import org.jboss.metadata.BeanMetaData;
import org.jboss.metadata.SessionMetaData;
@@ -65,27 +62,7 @@
*/
public ObjectName create(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return null;
-
- DeploymentInfo di = (DeploymentInfo) data;
- String ejbJarName = di.shortName;
- ObjectName ejbModuleService = di.deployedObject;
- ObjectName jsr77Name = EJBModule.create(server,
- FactoryUtils.findEarParent(di),
- ejbJarName,
- di.localUrl,
- ejbModuleService);
- moduleServiceToMgmtMap.put(ejbModuleService, jsr77Name);
- deploymentToModuleNameMap.put(di, jsr77Name);
- log.debug("Created module: " + jsr77Name);
- Iterator ejbs = di.mbeans.iterator();
- while (ejbs.hasNext())
- {
- ObjectName containerName = (ObjectName) ejbs.next();
- createEJB(server, containerName);
- }
- return jsr77Name;
+ return null;
}
/**
@@ -96,28 +73,7 @@
*/
public void destroy(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return;
-
- DeploymentInfo di = (DeploymentInfo) data;
- ObjectName jsr77Name = (ObjectName) deploymentToModuleNameMap.remove(di);
-
- log.debug("Destroy module: " + jsr77Name);
- Iterator ejbs = di.mbeans.iterator();
- while (ejbs.hasNext())
- {
- ObjectName containerName = (ObjectName) ejbs.next();
- destroyEJB(server, containerName);
- }
-
- if (jsr77Name != null)
- {
- EJBModule.destroy(server, jsr77Name);
- }
-
- ObjectName ejbModuleService = di.deployedObject;
- if (ejbModuleService != null)
- containerToModuleNameMap.remove(ejbModuleService);
+ return;
}
/**
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -22,7 +22,6 @@
package org.jboss.management.j2ee.factory;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployment.DeploymentInfo;
/**
* Common management factory utilities
@@ -33,25 +32,6 @@
public final class FactoryUtils
{
/**
- * For a given DeploymentInfo instance return the shortname of the
- * parent .ear, if one exists, or null.
- *
- * @param di the module
- * @return .ear parent shortname, or null
- */
- public static String findEarParent(DeploymentInfo di)
- {
- if (di.parent != null && di.parent.shortName.endsWith(".ear"))
- {
- return di.parent.shortName;
- }
- else
- {
- return null;
- }
- }
-
- /**
* For a given DeploymentUnit instance return the shortname of the
* parent .ear, if one exists, or null.
*
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/JCAResourceFactory.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/JCAResourceFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/JCAResourceFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,13 +21,8 @@
*/
package org.jboss.management.j2ee.factory;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.management.j2ee.JCAResource;
-
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import java.util.Iterator;
/**
* A factory for mapping DataSourceDeployer deployments to JCAResource
@@ -38,8 +33,6 @@
public class JCAResourceFactory
implements ManagedObjectFactory
{
- private static Logger log = Logger.getLogger(JCAResourceFactory.class);
-
/**
* Creates a JCAResource
*
@@ -49,57 +42,7 @@
*/
public ObjectName create(MBeanServer mbeanServer, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return null;
-
- DeploymentInfo di = (DeploymentInfo) data;
- ObjectName jsr77Name = null;
-
- /* Get the RARDeployment service name by looking for the mbean in the
- deployment with a name matching service=xxxDS. This relies on the naming
- pattern created by the JCA CM deployer.
- */
- ObjectName rarDeployService = null;
- ObjectName cmService = null;
- ObjectName poolService = null;
- Iterator iter = di.mbeans.iterator();
- while (iter.hasNext())
- {
- ObjectName oname = (ObjectName) iter.next();
- String name = oname.getKeyProperty("service");
- if (name.equals("ManagedConnectionFactory") || name.endsWith("DS"))
- rarDeployService = oname;
- else if (name.endsWith("CM"))
- cmService = oname;
- else if (name.endsWith("Pool"))
- poolService = oname;
- }
- if (rarDeployService == null || cmService == null)
- {
- log.debug("Failed to find a service=xxxDS match");
- return null;
- }
-
- try
- {
- /* Now to tie this CM back to its rar query the rarDeployService for
- the org.jboss.resource.RARDeployment service created by the RARDeployer.
- */
- ObjectName rarService = (ObjectName) mbeanServer.getAttribute(rarDeployService,
- "OldRarDeployment");
- // Get the ResourceAdapter JSR77 name
- ObjectName jsr77RAName = RARModuleFactory.getResourceAdapterName(rarService);
- // Now build the JCAResource
- String resName = rarDeployService.getKeyProperty("name");
- jsr77Name = JCAResource.create(mbeanServer, resName, jsr77RAName,
- cmService, rarDeployService, poolService);
- }
- catch (Exception e)
- {
- log.debug("Failed to create JCAResource", e);
- }
-
- return jsr77Name;
+ return null;
}
/**
@@ -110,34 +53,6 @@
*/
public void destroy(MBeanServer mbeanServer, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return;
-
- DeploymentInfo di = (DeploymentInfo) data;
- String resName = getDeploymentResName(mbeanServer, di);
- JCAResource.destroy(mbeanServer, resName);
+ return;
}
-
- private String getDeploymentResName(MBeanServer mbeanServer, DeploymentInfo di)
- {
- String resName = null;
- /* Get the RARDeployment service name by looking for the mbean in the
- deployment with a name matching service=xxxDS. This relies on the naming
- pattern created by the JCA CM deployer.
- */
- ObjectName rarDeployService = null;
- Iterator iter = di.mbeans.iterator();
- while (iter.hasNext())
- {
- ObjectName oname = (ObjectName) iter.next();
- String name = oname.getKeyProperty("service");
- if (name.equals("ManagedConnectionFactory") || name.endsWith("DS"))
- {
- rarDeployService = oname;
- resName = rarDeployService.getKeyProperty("name");
- break;
- }
- }
- return resName;
- }
}
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/RARModuleFactory.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/RARModuleFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/RARModuleFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,15 +21,8 @@
*/
package org.jboss.management.j2ee.factory;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.management.j2ee.ResourceAdapter;
-import org.jboss.management.j2ee.ResourceAdapterModule;
-import org.jboss.resource.metadata.ConnectorMetaData;
-
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import java.util.HashMap;
/**
* A factory for mapping RARDeployer deployments to ResourceAdaptorModules
@@ -40,16 +33,6 @@
public class RARModuleFactory
implements ManagedObjectFactory
{
- private static Logger log = Logger.getLogger(RARModuleFactory.class);
- private static HashMap moduleServiceToMgmtMap = new HashMap();
- private HashMap deploymentToModuleNameMap = new HashMap();
-
- static ObjectName getResourceAdapterName(ObjectName rarService)
- {
- ObjectName jsr77Name = (ObjectName) moduleServiceToMgmtMap.get(rarService);
- return jsr77Name;
- }
-
/**
* Create JSR-77 EJBModule
*
@@ -58,29 +41,7 @@
*/
public ObjectName create(MBeanServer mbeanServer, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return null;
-
- DeploymentInfo di = (DeploymentInfo) data;
- ConnectorMetaData metaData = (ConnectorMetaData) di.metaData;
-
- // Create the ResourceAdapterModule
- String rarName = di.shortName;
- ObjectName rarService = di.deployedObject;
- ObjectName jsr77ModuleName = ResourceAdapterModule.create(mbeanServer,
- FactoryUtils.findEarParent(di),
- rarName,
- di.localUrl);
- deploymentToModuleNameMap.put(di, jsr77ModuleName);
- log.debug("Created module: " + jsr77ModuleName);
-
- // Create the ResourceAdapter
- ObjectName jsr77RAName = ResourceAdapter.create(mbeanServer,
- metaData.getDescription().getDisplayName(), jsr77ModuleName, rarService);
- // Register a mapping from the RARDeployment service to the ResourceAdapter
- moduleServiceToMgmtMap.put(rarService, jsr77RAName);
-
- return jsr77ModuleName;
+ return null;
}
/**
@@ -91,19 +52,7 @@
*/
public void destroy(MBeanServer mbeanServer, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return;
-
- DeploymentInfo di = (DeploymentInfo) data;
- ConnectorMetaData metaData = (ConnectorMetaData) di.metaData;
- ObjectName jsr77Name = (ObjectName) deploymentToModuleNameMap.get(di);
-
- ResourceAdapter.destroy(mbeanServer, metaData.getDescription().getDisplayName());
- log.debug("Destroy module: " + jsr77Name);
- if (jsr77Name != null)
- {
- ResourceAdapterModule.destroy(mbeanServer, jsr77Name);
- }
+ return;
}
}
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/ServiceModuleFactory.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/ServiceModuleFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/ServiceModuleFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,15 +21,8 @@
*/
package org.jboss.management.j2ee.factory;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.management.j2ee.MBean;
-import org.jboss.management.j2ee.ServiceModule;
-
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import java.util.List;
-import java.util.ListIterator;
/**
* @author Scott.Stark at jboss.org
@@ -38,8 +31,6 @@
public class ServiceModuleFactory
implements ManagedObjectFactory
{
- private static Logger log = Logger.getLogger(ServiceModuleFactory.class);
-
/**
* Create JSR-77 SAR-Module
*
@@ -48,70 +39,11 @@
*/
public ObjectName create(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return null;
-
- DeploymentInfo di = (DeploymentInfo) data;
- String moduleName = di.shortName;
- ObjectName sarName = ServiceModule.create(server, moduleName, di.localUrl);
- if (sarName != null)
- {
- log.debug("Created ServiceModule: " + sarName);
- }
-
- try
- {
- List mbeans = di.mbeans;
- for (int i = 0; i < mbeans.size(); i++)
- {
- ObjectName mbeanName = (ObjectName) mbeans.get(i);
- // Create JSR-77 MBean
- MBean.create(server, sarName.toString(), mbeanName);
- log.debug("Create MBean, name: " + mbeanName + ", SAR Module: " + sarName);
- }
- }
- catch (Throwable e)
- {
- log.debug("Failed to create MBean, sarName:" + sarName, e);
- }
-
- return sarName;
+ return null;
}
public void destroy(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return;
-
- DeploymentInfo di = (DeploymentInfo) data;
- List services = di.mbeans;
- int lastService = services.size();
-
- for (ListIterator i = services.listIterator(lastService); i.hasPrevious();)
- {
- ObjectName name = (ObjectName) i.previous();
- try
- {
- // Destroy JSR-77 MBean
- MBean.destroy(server, name.toString());
- log.debug("Destroy MBean, name: " + name);
- }
- catch (Throwable e)
- {
- log.debug("Failed to remove remove JSR-77 MBean", e);
- } // end of try-catch
- }
-
- // Remove JSR-77 SAR-Module
- String moduleName = di.shortName;
- try
- {
- ServiceModule.destroy(server, moduleName);
- log.debug("Removed JSR-77 SAR: " + moduleName);
- }
- catch (Throwable e)
- {
- log.debug("Failed to remove JSR-77 SAR: " + moduleName);
- }
+ return;
}
}
Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/WebModuleFactory.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/WebModuleFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/WebModuleFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,16 +21,14 @@
*/
package org.jboss.management.j2ee.factory;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.management.j2ee.Servlet;
-import org.jboss.management.j2ee.WebModule;
+import java.util.HashMap;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import java.util.HashMap;
-import java.util.Iterator;
+import org.jboss.logging.Logger;
+import org.jboss.management.j2ee.Servlet;
+
/**
* A factory for mapping WARDeployer deployments to WebModules
*
@@ -52,31 +50,7 @@
*/
public ObjectName create(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return null;
-
- DeploymentInfo di = (DeploymentInfo) data;
- String warName = di.shortName;
- ObjectName webModuleService = di.deployedObject;
- String earName = FactoryUtils.findEarParent(di);
- ObjectName jsr77Name = WebModule.create(server,
- earName, warName, di.localUrl, webModuleService);
- deploymentToModuleNameMap.put(di, jsr77Name);
- Iterator servlets = di.mbeans.iterator();
- while (servlets.hasNext())
- {
- Object next = servlets.next();
- try
- {
- ObjectName servletName = (ObjectName) next;
- createServlet(server, jsr77Name, servletName);
- }
- catch (Throwable e)
- {
- log.debug("Failed to create JSR-77 servlet: " + next, e);
- }
- }
- return jsr77Name;
+ return null;
}
/**
@@ -87,32 +61,7 @@
*/
public void destroy(MBeanServer server, Object data)
{
- if ((data instanceof DeploymentInfo) == false)
- return;
-
- DeploymentInfo di = (DeploymentInfo) data;
- ObjectName jsr77Name = (ObjectName) deploymentToModuleNameMap.remove(di);
-
- log.debug("Destroy module: " + jsr77Name);
- Iterator servlets = di.mbeans.iterator();
- while (servlets.hasNext())
- {
- Object next = servlets.next();
- try
- {
- ObjectName servletName = (ObjectName) next;
- destroyServlet(server, servletName);
- }
- catch (Throwable e)
- {
- log.debug("Failed to destroy JSR-77 servlet: " + next, e);
- }
- }
-
- if (jsr77Name != null)
- {
- WebModule.destroy(server, jsr77Name);
- }
+ return;
}
/**
Modified: trunk/server/src/main/org/jboss/deployment/EARDeployerMBean.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EARDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/server/src/main/org/jboss/deployment/EARDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -32,7 +32,7 @@
* @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
* @version $Revision$
*/
-public interface EARDeployerMBean extends SubDeployerExtMBean
+public interface EARDeployerMBean
{
/** The default ObjectName */
ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.j2ee:service=EARDeployer");
Modified: trunk/server/src/main/org/jboss/ejb/Container.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/Container.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/server/src/main/org/jboss/ejb/Container.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -56,7 +56,6 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.ejb.plugins.local.BaseLocalProxyFactory;
import org.jboss.ejb.txtimer.EJBTimerService;
import org.jboss.ejb.txtimer.EJBTimerServiceImpl;
@@ -89,10 +88,10 @@
import org.jboss.security.AnybodyPrincipal;
import org.jboss.security.AuthenticationManager;
import org.jboss.security.ISecurityManagement;
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.authorization.PolicyRegistration;
import org.jboss.security.RealmMapping;
+import org.jboss.security.SecurityConstants;
import org.jboss.security.SimplePrincipal;
+import org.jboss.security.authorization.PolicyRegistration;
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.util.NestedError;
import org.jboss.util.NestedRuntimeException;
@@ -436,25 +435,6 @@
return (EJBProxyFactory)proxyFactories.get(binding);
}
- /**
- * Gets the DeploymentInfo for this Container
- * @deprecated use DeploymentUnit accessors
- * @return The DeploymentInfo for this Container
- */
- public final DeploymentInfo getDeploymentInfo()
- {
- return null;
- }
-
- /**
- * Sets the DeploymentInfo of this Container
- * @deprecated use DeploymentUnit accessors
- * @param di The new DeploymentInfo to be used
- */
- public final void setDeploymentInfo(DeploymentInfo di)
- {
- }
-
public final VFSDeploymentUnit getDeploymentUnit()
{
return unit;
Modified: trunk/server/src/main/org/jboss/ejb/EJBDeployerMBean.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EJBDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/server/src/main/org/jboss/ejb/EJBDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -25,13 +25,12 @@
import javax.management.ObjectName;
-import org.jboss.deployment.SubDeployerExtMBean;
import org.jboss.mx.util.ObjectNameFactory;
/**
* EJBDeployer MBean interface.
*/
-public interface EJBDeployerMBean extends SubDeployerExtMBean
+public interface EJBDeployerMBean
{
/** The default ObjectName */
ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ejb:service=EJBDeployer");
Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -49,7 +49,6 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.ejb.plugins.SecurityProxyInterceptor;
import org.jboss.ejb.plugins.StatefulSessionInstancePool;
import org.jboss.ejb.txtimer.EJBTimerService;
@@ -216,15 +215,6 @@
unit.addAttachment(ApplicationMetaData.class, metaData);
}
- /**
- * @deprecated DeploymentInfo is obsolete
- */
- @Deprecated
- public EjbModule(final DeploymentInfo di, TransactionManager tm, ObjectName webServiceName)
- {
- this.name = "deprecated";
- }
-
public void setTransactionManagerFactory(TransactionManagerFactory tm)
{
this.tmFactory = tm;
@@ -622,7 +612,6 @@
con.setWebClassLoader(null);
con.setClassLoader(null);
con.setEjbModule(null);
- con.setDeploymentInfo(null);
con.setTransactionManager(null);
con.setSecurityManager(null);
con.setRealmMapping(null);
Modified: trunk/server/src/main/org/jboss/web/AbstractWebContainerMBean.java
===================================================================
--- trunk/server/src/main/org/jboss/web/AbstractWebContainerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/server/src/main/org/jboss/web/AbstractWebContainerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -25,7 +25,7 @@
* MBean interface.
* @see org.jboss.web.AbstractWebDeployer
*/
-public interface AbstractWebContainerMBean extends org.jboss.deployment.SubDeployerMBean {
+public interface AbstractWebContainerMBean {
/**
* Get the flag indicating if the normal Java2 parent first class loading model should be used over the servlet 2.3 web container first model.
Modified: trunk/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java
===================================================================
--- trunk/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -31,7 +31,7 @@
* @see org.jboss.security.SimplePrincipal;
* @see org.jboss.security.SecurityAssociation;
*/
-public interface AbstractWebDeployerMBean extends org.jboss.deployment.SubDeployerMBean {
+public interface AbstractWebDeployerMBean {
//default object name
public static final javax.management.ObjectName OBJECT_NAME = org.jboss.mx.util.ObjectNameFactory.create("jboss.web:service=WebServer");
Deleted: trunk/spring-int/src/main/org/jboss/spring/kernel/MicrocontainerLoaderImpl.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/kernel/MicrocontainerLoaderImpl.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/spring-int/src/main/org/jboss/spring/kernel/MicrocontainerLoaderImpl.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.spring.kernel;
-
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.spring.loader.AbstractBeanFactoryLoader;
-import org.jboss.spring.factory.NamedXmlApplicationContext;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.io.Resource;
-
-/**
- * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
- */
-public class MicrocontainerLoaderImpl extends AbstractBeanFactoryLoader
-{
-
- protected BeanFactory createBeanFactory(String defaultName, Resource resource)
- {
- ConfigurableApplicationContext applicationContext = new NamedXmlApplicationContext(defaultName, resource, false);
- MicrocontainerConfigurer microcontainerPostProcessor = new MicrocontainerConfigurer();
- Locator locator = new NullLocator();
- KernelController controller = getKernelController();
- Kernel kernel = getKernel();
- if (controller != null)
- {
- locator = new ControllerLocator(controller);
- }
- else if (kernel != null)
- {
- locator = new KernelLocator(kernel);
- }
- microcontainerPostProcessor.setLocator(locator);
- applicationContext.addBeanFactoryPostProcessor(microcontainerPostProcessor);
- applicationContext.refresh();
- return applicationContext;
- }
-
- protected void doClose(BeanFactory beanFactory)
- {
- ((ConfigurableApplicationContext) beanFactory).close();
- }
-
- protected Class getExactBeanFactoryClass()
- {
- return ApplicationContext.class;
- }
-
- protected Kernel getKernel()
- {
- return null;
- }
-
- protected KernelController getKernelController()
- {
- return null;
- }
-
-}
Deleted: trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployer.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.spring.kernel;
-
-import javax.management.ObjectName;
-
-import org.jboss.spring.deployment.SpringDeployer;
-import org.jboss.spring.loader.BeanFactoryLoader;
-
-/**
- * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
- * @jmx:mbean name="jboss.spring:service=SpringApplicationContextDeployer"
- * extends="org.jboss.deployment.SubDeployerMBean"
- */
-public class SpringMicrocontainerDeployer extends SpringDeployer
-{
-
- //default object name
- public static final ObjectName OBJECT_NAME =
- org.jboss.mx.util.ObjectNameFactory.create("jboss.spring:service=SpringMicrocontainerDeployer");
-
- public SpringMicrocontainerDeployer()
- {
- super();
- }
-
- protected BeanFactoryLoader createBeanFactoryLoader()
- {
- return new MicrocontainerLoaderImpl();
- }
-
- protected ObjectName getDefaultObjectName()
- {
- return OBJECT_NAME;
- }
-
-}
Deleted: trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployerMBean.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/spring-int/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.spring.kernel;
-
-import org.jboss.spring.deployment.SpringDeployerMBean;
-
-/**
- * MBean interface.
- *
- * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
- */
-public interface SpringMicrocontainerDeployerMBean extends SpringDeployerMBean
-{
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/DefaultDeploymentSorter.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/DefaultDeploymentSorter.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/DefaultDeploymentSorter.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface DefaultDeploymentSorter
-{
- String[] getSuffixOrder();
-
- void setSuffixOrder(String[] suffixOrder);
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfo.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfo.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfo.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,502 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.loading.LoaderRepositoryFactory;
-import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
-import org.jboss.mx.loading.RepositoryClassLoader;
-import org.jboss.util.collection.ListSet;
-import org.jboss.util.file.Files;
-import org.w3c.dom.Document;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.Serializable;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.*;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-/**
- * Service Deployment Info .
- *
- * Every deployment (even the J2EE ones) should be seen at some point as
- * Service Deployment info
- *
- * @see org.jboss.system.Service
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:David.Maplesden at orion.co.nz">David Maplesden</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:daniel.schulze at telkel.com">Daniel Schulze</a>
- * @author <a href="mailto:Christoph.Jung at infor.de">Christoph G. Jung</a>
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @version $Revision$ <p>
- */
-public class DeploymentInfo implements Serializable
-{
- /** @since 4.0.1 */
- private static final long serialVersionUID = 1131841473723490707L;
-
- private static final Logger log = Logger.getLogger(DeploymentInfo.class);
-
- // Variables ------------------------------------------------------------
-
- /** The initial construction timestamp */
- public Date date = new Date();
-
- /** the URL identifing this SDI **/
- public URL url;
-
- /** An optional URL to a local copy of the deployment */
- public URL localUrl;
-
- /** The URL used to watch for changes when the deployment is unpacked */
- public URL watch;
-
- /** The suffix of the deployment url */
- public String shortName;
-
- /** The last system time the deployment inited by the MainDeployer */
- public long lastDeployed = 0;
-
- /** use for "should we redeploy failed" */
- public long lastModified = 0;
-
- /** A free form status for the "state" can be Deployed/failed etc etc */
- public String status;
-
- /** The current state of the deployment */
- public DeploymentState state = DeploymentState.CONSTRUCTED;
-
- /** The subdeployer that handles the deployment */
- public transient SubDeployer deployer;
-
- /** Unified CL is a global scope class loader **/
- public transient RepositoryClassLoader ucl;
-
- /** local Cl is a CL that is used for metadata loading, if ejb-jar.xml is
- left in the parent CL through old deployments, this makes sure that we
- use the local version. You must use the URLClassLoader.findResource method
- to restrict loading to the deployment URL.
- */
- public transient URLClassLoader localCl;
-
- /** A CL for preloading annotations, it should be made available
- * in the deployment create step.
- */
- public transient URLClassLoader annotationsCl;
-
- /** The classpath declared by this xml descriptor, needs <classpath> entry **/
- public final Collection classpath = new ArrayList();
-
- /** The mbeans deployed */
- public final List<ObjectName> mbeans = new ArrayList<ObjectName>();
-
- /** Anyone can have subdeployments */
- public final Set subDeployments = new ListSet();
-
- /** And the subDeployments have a parent */
- public DeploymentInfo parent = null;
-
- /** the web root context in case of war file */
- public String webContext;
-
- /** the manifest entry of the deployment (if any)
- * manifest is not serializable ... is only needed
- * at deployment time, so we mark it transient
- */
- public transient Manifest manifest;
-
- /**
- * Each Deployment is really mapping one to one to a XML document, here in
- * its parsed form. A xerces document (org.apache.xerces.dom.DocumentImpl)
- * is serializable.
- */
- public Document document;
-
- /** An optional URL to the URL of the document loaded */
- public URL documentUrl;
-
- /** We can hold "typed" metadata, really an interpretation of the bare XML document */
- public transient Object metaData;
-
- /** If this deployed as part of an EAR, there may be an alernative DD */
- public String alternativeDD;
-
- /** An arbitrary map of state associated with the deployment */
- public transient HashMap context = new HashMap();
-
- /** Is this a stand-alone service descriptor */
- public boolean isXML;
-
- /** Is this a stand-alone script */
- public boolean isScript;
-
- /** Does the deployment url point to a directory */
- public boolean isDirectory;
-
- /** Are the subdeploymets already sorted */
- public boolean sortedSubDeployments = false ;
- /**
- * The variable <code>deployedObject</code> can contain the MBean that
- * is created through the deployment. for instance, deploying an ejb-jar
- * results in an EjbModule mbean, which is stored here.
- */
- public ObjectName deployedObject;
-
- /** The configuration of the loader repository for this deployment */
- public LoaderRepositoryConfig repositoryConfig;
-
- /** The MBeanServer associated with the deployment */
- private transient MBeanServer server;
-
- /**
- * CTOR
- */
- public DeploymentInfo(final URL url, final DeploymentInfo parent, final MBeanServer server)
- throws DeploymentException
- {
- this.server = server;
- // The key url the deployment comes from
- this.url = url;
-
- // this may be changed by deployers in case of directory and xml file following
- this.watch = url;
-
- // Whether we are part of a subdeployment or not
- this.parent = parent;
-
- // Is it a directory?
- if (url.getProtocol().startsWith("file") && new File(url.getFile()).isDirectory())
- this.isDirectory = true;
-
- // Does it even exist?
- if (!isDirectory)
- {
- try
- {
- url.openStream().close();
- }
- catch (Exception e)
- {
- throw new DeploymentException("url " + url + " could not be opened, does it exist?");
- }
- }
-
- if (parent != null)
- {
- parent.subDeployments.add(this);
- // Use the repository of our topmost parent
- repositoryConfig = getTopRepositoryConfig();
- }
-
- // The "short name" for the deployment http://myserver/mybean.ear should yield "mybean.ear"
- shortName = getShortName(url.getPath());
-
- // Do we have an XML descriptor only deployment?
- isXML = shortName.toLowerCase().endsWith(".xml");
-
- // Do we have a stand-olone script deployment?
- isScript = shortName.toLowerCase().endsWith(".bsh");
- }
-
- public MBeanServer getServer()
- {
- return server;
- }
-
- public void setServer(MBeanServer server)
- {
- this.server = server;
- }
-
- /** Create a UnifiedClassLoader for the deployment that loads from
- the localUrl and uses its parent deployments url as its orignal
- url. Previously xml descriptors simply used the TCL but since the UCLs
- are now registered as mbeans each must be unique.
- */
- public void createClassLoaders() throws Exception
- {
- // create a local classloader for local files, don't go with the UCL for ejb-jar.xml
- if( localCl == null )
- localCl = new URLClassLoader(new URL[] {localUrl});
-
- /* Walk the deployment tree to find the parent deployment and obtain its
- url to use as our URL from which this deployment unit originated. This
- is used to determine permissions using the original URL namespace.
- Also pick up the LoaderRepository from the topmost ancestor.
- */
- URL origUrl = url;
- DeploymentInfo current = this;
- while (current.parent != null)
- {
- current = current.parent;
- }
- origUrl = current.url;
- repositoryConfig = current.repositoryConfig;
- if( parent == null )
- {
- if( repositoryConfig == null )
- repositoryConfig = new LoaderRepositoryConfig();
- // Make sure the specified LoaderRepository exists.
- LoaderRepositoryFactory.createLoaderRepository(server, repositoryConfig);
- log.debug("createLoaderRepository from config: "+repositoryConfig);
- // the classes are passed to a UCL that will share the classes with the whole base
-
- Object[] args = { isXML ? null : localUrl, origUrl, Boolean.TRUE };
- String[] sig = { "java.net.URL", "java.net.URL", "boolean" };
- ucl = (RepositoryClassLoader) server.invoke(repositoryConfig.repositoryName,
- "newClassLoader",args, sig);
- }
- else
- {
- // Add a reference to the LoaderRepository
- LoaderRepositoryFactory.createLoaderRepository(server, repositoryConfig);
- // Add the deployment URL to the parent UCL
- ucl = parent.ucl;
- ucl.addURL(localUrl);
- }
- // Add any library jars seen before the UCL was created
- if( classpath.size() > 0 )
- {
- Iterator jars = classpath.iterator();
- while( jars.hasNext() )
- {
- URL jar = (URL) jars.next();
- ucl.addURL(jar);
- }
- }
- }
-
- /** Set the UnifiedLoaderRepository info for the deployment. This can only
- * be called for the parent deployment, and must be done early in the
- * Subdeployer init(DeploymentInfo) method prior to any class loading.
- * @throws Exception
- */
- public void setRepositoryInfo(LoaderRepositoryConfig config)
- throws Exception
- {
- if( parent != null )
- {
- log.warn("Only the root deployment can set the loader repository, "
- + "ignoring config="+config);
- return;
- }
-
- this.repositoryConfig = config;
- // Recreate the ucl if it exists
- if( ucl != null )
- {
- ucl.unregister();
- // Make sure the specified LoaderRepository exists.
- LoaderRepositoryFactory.createLoaderRepository(server, repositoryConfig);
- log.debug("createLoaderRepository from config: "+repositoryConfig);
- // the classes are passed to a UCL that will share the classes with the whole base
-
- Object[] args = { isXML ? null : localUrl, url, Boolean.TRUE };
- String[] sig = { "java.net.URL", "java.net.URL", "boolean" };
- ucl = (RepositoryClassLoader) server.invoke(repositoryConfig.repositoryName,
- "newClassLoader",args, sig);
- }
- }
-
- /** All library jars referenced through either the manifest references
- * or sar classpaths are added to the root DeploymentInfo class loader. This
- * is neccessary to avoid IllegalAccessErrors due to classes in a pkg
- * being split across jars
- */
- public void addLibraryJar(URL libJar)
- {
- DeploymentInfo current = this;
- while (current.parent != null)
- {
- current = current.parent;
- }
- /* If the UCL exists add the jar to it else use the classpath to
- indicate that the jars need to be added when the ucl is created.
- */
- if( current.ucl != null )
- current.ucl.addURL(libJar);
- else
- classpath.add(libJar);
- }
-
- /** The the class loader repository name of the top most DeploymentInfo
- */
- public LoaderRepositoryConfig getTopRepositoryConfig()
- {
- LoaderRepositoryConfig topConfig = repositoryConfig;
- DeploymentInfo info = this;
- while( info.parent != null )
- {
- info = info.parent;
- topConfig = info.repositoryConfig;
- }
- return topConfig;
- }
-
- /**
- * getManifest returns (if present) the deployment's manifest
- * it is lazy loaded to work from the localURL
- */
- public Manifest getManifest()
- {
- try
- {
- if (manifest == null)
- {
- File file = new File(localUrl.getFile());
-
- if (file.isDirectory())
- {
- FileInputStream fis = new FileInputStream(new File(file, "META-INF/MANIFEST.MF"));
- try
- {
- manifest = new Manifest(fis);
- }
- finally
- {
- fis.close();
- }
- }
- else if(isXML == false)// a jar
- manifest = new JarFile(file).getManifest();
- }
-
- return manifest;
- }
- // It is ok to barf at any time in the above, means no manifest
- catch (Exception ignored) { return null;}
- }
-
- public void cleanup()
- {
- // Remove the deployment UCL
- if( parent == null && ucl != null )
- ucl.unregister();
- ucl = null;
-
- // Remove any deployment specific repository
- if ( repositoryConfig != null )
- {
- LoaderRepositoryFactory.destroyLoaderRepository(server,
- repositoryConfig.repositoryName);
- }
-
- subDeployments.clear();
- mbeans.clear();
- context.clear();
- if (localUrl == null || localUrl.equals(url))
- {
- log.debug("Not deleting localUrl, it is null or not a copy: " + localUrl);
- }
- else if (Files.delete(localUrl.getFile()))
- {
- log.debug("Cleaned Deployment: " + localUrl);
- }
- else
- {
- log.debug("Could not delete " + localUrl + " restart will delete it");
- }
-
- // Clean up references to other objects
- localCl = null;
- annotationsCl = null;
- localUrl = null;
- repositoryConfig = null;
- watch = null;
- parent = null;
- manifest = null;
- document = null;
- metaData = null;
- server = null;
- classpath.clear();
- state = DeploymentState.DESTROYED;
- // Who is using this after clear?
- // deployer = null;
- }
-
- /** The sortName concatenated with the canonical names of all parents. */
- public String getCanonicalName()
- {
- String name = shortName;
- if (parent != null)
- name = parent.getCanonicalName() + "/" + name;
- return name;
- }
-
- private String getShortName(String name)
- {
- if (name.endsWith("/")) name = name.substring(0, name.length() - 1);
- name = name.substring(name.lastIndexOf("/") + 1);
- return name;
- }
-
- public int hashCode()
- {
- return url.hashCode();
- }
-
- public boolean equals(Object other)
- {
- if (other instanceof DeploymentInfo)
- {
- return ((DeploymentInfo) other).url.equals(this.url);
- }
- return false;
- }
-
- public String toString()
- {
- StringBuffer s = new StringBuffer(super.toString());
- s.append(" { url=" + url + " }\n");
- s.append(" deployer: " + deployer + "\n");
- s.append(" status: " + status + "\n");
- s.append(" state: " + state + "\n");
- s.append(" watch: " + watch + "\n");
- s.append(" altDD: " + alternativeDD + "\n");
- s.append(" lastDeployed: " + lastDeployed + "\n");
- s.append(" lastModified: " + lastModified + "\n");
- s.append(" mbeans:\n");
- for (Iterator i = mbeans.iterator(); i.hasNext(); )
- {
- ObjectName o = (ObjectName)i.next();
- try
- {
- String state = (String)server.getAttribute(o, "StateString");
- s.append(" " + o + " state: " + state + "\n");
- }
- catch (Exception e)
- {
- s.append(" " + o + " (state not available)\n");
- } // end of try-catch
-
- } // end of for ()
-
- return s.toString();
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfoComparator.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfoComparator.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/DeploymentInfoComparator.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.util.Comparator;
-
-/**
- * This comparator takes a delegate comparator that can compare URLs, and
- * applies that to DeploymentInfo objects
- */
-public class DeploymentInfoComparator implements Comparator {
-
- /** the delegate URL comparator */
- private Comparator urlComparator;
-
- public DeploymentInfoComparator(Comparator comp) {
- this.urlComparator = comp;
- }
-
- public int compare(Object o1, Object o2) {
- return urlComparator.compare(((DeploymentInfo)o1).url, ((DeploymentInfo)o2).url);
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/DeploymentSorter.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/DeploymentSorter.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/DeploymentSorter.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.net.URL;
-import java.util.Comparator;
-
-import org.jboss.util.NullArgumentException;
-
-/**
- * A helper class for sorting deployments.
- *
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author Scott.Stark at jboss.org
- */
-public class DeploymentSorter implements Comparator, DefaultDeploymentSorter
-{
- /**
- * The default order for sorting deployments; this has been deprecated,
- * order is really defined in SuffixOrderHelper class and/or individualy
- * within each subdeployer.
- *
- * @deprecated
- */
- public static final String[] DEFAULT_SUFFIX_ORDER = {
- ".deployer", "-deployer.xml", ".sar", "-service.xml", ".rar", "-ds.xml",
- ".har", ".jar", ".war", ".wsr", ".ear", ".zip", ".bsh", ".last"
- };
-
- protected String[] suffixOrder;
-
- public DeploymentSorter(String[] suffixOrder)
- {
- if (suffixOrder == null)
- throw new NullArgumentException("suffixOrder");
-
- this.suffixOrder = suffixOrder;
- }
-
- public DeploymentSorter()
- {
- this(DEFAULT_SUFFIX_ORDER);
- }
-
- public String[] getSuffixOrder()
- {
- return suffixOrder;
- }
- public void setSuffixOrder(String[] suffixOrder)
- {
- this.suffixOrder = suffixOrder;
- }
-
- /**
- * Return a negative number if o1 appears lower in the the suffix order than
- * o2.
- * If the suffixes are indentical, then sorts based on name.
- * This is so that deployment order of components is always identical.
- */
- public int compare(Object o1, Object o2)
- {
- URL u1 = (URL)o1;
- URL u2 = (URL)o2;
- int order = getExtensionIndex(u1) - getExtensionIndex(u2);
- if (order != 0)
- return order;
- return u1.getFile().compareTo(u2.getFile());
- }
-
- /**
- * Return the index that matches this url
- */
- public int getExtensionIndex(URL url)
- {
- String path = url.getPath();
- if (path.endsWith("/"))
- path = path.substring(0, path.length() - 1);
- int i = 0;
- for (; i < suffixOrder.length; i++)
- {
- if (path.endsWith(suffixOrder[i]))
- break;
- }
- return i;
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/JARDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/JARDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/JARDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,251 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import org.jboss.util.Strings;
-
-/**
- * This deployer exists to prevent deployment of packages whose deployers are not yet
- * deployed. It will accept only jar/zip format files or directories that don't
- * have a META-INF directory, or if they do, don't have any .xml files there. It
- * assumes any package with a META-INF/*.xml file needs a specialized deployer.
- *
- * @todo find a way to scan just the META-INF files, not the whole jar.
- *
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public class JARDeployer extends SubDeployerSupport
- implements JARDeployerMBean
-{
- /**
- * The suffixes we accept, along with their relative order.
- *
- * For JARDeployer, this is only used to populate the MainDeployer's
- * SuffixOrder list, it is not used to actually match deployment suffixes
- */
- private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] {
- "700:.jar", // normal .jar
- "750:.zip", // normal .zip
- "900:.last" // make content of .last dirs/archives deploy last
- };
-
- private String[] descriptorNames = {
- ".xml"
- };
-
- /**
- * Default CTOR
- */
- public JARDeployer()
- {
- super.setEnhancedSuffixes(DEFAULT_ENHANCED_SUFFIXES);
- }
-
- public String[] getDescriptorNames()
- {
- return descriptorNames;
- }
-
- public void setDescriptorNames(String[] descriptorNames)
- {
- this.descriptorNames = descriptorNames;
- }
-
- // ServiceMBeanSupport methods
-
- protected void stopService()
- {
- // This can't be run right now since the JARDeployer is started before the MainDeployer,
- // so the MainDeployer is stopped first... so the JARDeployer can't unregister.
-
- // super.stopService();
- }
-
- // SubDeployer implementation
-
- /**
- * The <code>accepts</code> method is called by MainDeployer to
- * determine which deployer is suitable for a DeploymentInfo.
- *
- * @todo find a way to scan just the META-INF files, not the whole jar.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @return a <code>boolean</code> value
- */
- public boolean accepts(DeploymentInfo di)
- {
- boolean trace = log.isTraceEnabled();
-
- try
- {
- // Reject extensions not configured in this subdeployer
- // but do consider accepting non-dotted deployments,
- // like deploy-hasingleton
- if (di.shortName.indexOf('.') != -1 && super.accepts(di) == false)
- {
- return false;
- }
-
- // Reject deployments with a WEB-INF/ directory
- URL wdDir = di.localCl.findResource("WEB-INF/");
- if (wdDir != null)
- {
- return false;
- }
-
- // Since a META-INF directory exists within rt.jar, we can't just do a
- // getResource (it will always return rt.jar's version).
- // The method we want is findResource, but it is marked protected in
- // ClassLoader. Fortunately, URLClassLoader exposes it which makes
- // this hack possible. Anybody have a better way to check a URL
- // for the existance of a META-INF??
- URL ddDir;
- try
- {
- ddDir = di.localCl.findResource("META-INF/");
- if (ddDir == null)
- {
- log.debug("No META-INF or WEB-INF resource found, assuming it if for us");
- return true;
- }
- }
- catch (ClassCastException e)
- {
- // assume there is a META-INF...
- ddDir = new URL(di.url, "META-INF/");
- }
-
- if (ddDir.getProtocol().equals("file"))
- {
- log.trace("File protocol: "+ddDir);
- File file = new File(ddDir.getFile());
- if (!file.exists())
- {
- log.warn("File not found: " + file);
- return true;
- }
-
- // Scan for any xml files in the META-INF dir
- File[] entries = file.listFiles(
- new FileFilter()
- {
- public boolean accept(File pathname)
- {
- boolean accept = false;
- String name = pathname.getName();
- for(int n = 0; accept == false && n < descriptorNames.length; n ++)
- {
- String d = descriptorNames[n];
- accept = name.endsWith(d);
- }
- return accept;
- }
- }
- );
- log.debug("XML entries found: " + entries.length);
- return entries.length == 0;
- } // end of if ()
- else if (ddDir.getProtocol().equals("jar") == true)
- {
- log.trace("jar protocol: " + ddDir);
- JarFile jarFile = null;
-
- try
- {
- URLConnection con = ddDir.openConnection();
- JarURLConnection jarConn = (JarURLConnection) con;
- /* Need to set caching to false otherwise closing the jarfile
- ends up conflicting with other users of the cached jar.
- */
- jarConn.setUseCaches(false);
- jarFile = jarConn.getJarFile();
-
- // Scan for any xml files in the META-INF dir
- if (trace)
- log.trace("Descriptor names=" + Arrays.asList(descriptorNames));
- for (Enumeration e = jarFile.entries(); e.hasMoreElements();)
- {
- JarEntry entry = (JarEntry)e.nextElement();
- String name = entry.getName();
- if (trace)
- log.trace("Looking at entry: '" + name + "'");
-
- // JBAS-2949 - Look for xml descriptors directly
- // under META-INF/, not in META-INF/ subdirectories
- if (name.startsWith("META-INF/") && Strings.count(name, "/") == 1)
- {
- for (int n = 0; n < descriptorNames.length; n ++)
- {
- if (name.endsWith(descriptorNames[n]))
- {
- log.debug("Found entry: '" + name + "', matching: '"
- + descriptorNames[n] + "', rejecting jar");
-
- // Do not accept this as jar file
- return false;
- }
- }
- }
- }
- }
- catch (Exception e)
- {
- log.warn("Looking inside jar failed; ignoring", e);
- return false;
- }
- finally
- {
- if (jarFile != null)
- jarFile.close();
- jarFile = null;
- }
-
- log.debug("No xml files found");
- return true;
- }
- else
- {
- log.debug("Unrecognized protocol: " + ddDir.getProtocol());
- }
-
- return false;
- }
- catch (Exception e)
- {
- log.trace("Ignored error", e);
- return false;
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/JARDeployerMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/JARDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/JARDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * MBean interface.
- *
- * @version $Revision$
- */
-public interface JARDeployerMBean extends SubDeployerMBean
-{
- /** The default ObjectName */
- ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:service=JARDeployer");
-
- /**
- * The list of suffixes that define deployment descriptors which if
- * found in an archive META-INF directory indicate non-jar deployments
- * that should be ignored by the JARDeployer.
- */
- void setDescriptorNames(String[] descriptorNames);
- String[] getDescriptorNames();
-
-}
Modified: trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -97,27 +97,6 @@
* with deployment problems.
*/
private ObjectName serviceController;
-
- /** Deployers **/
- private final LinkedList deployers = new LinkedList();
-
- /** A Map of URL -> DeploymentInfo */
- private final Map deploymentMap = Collections.synchronizedMap(new HashMap());
-
- /** A list of all deployments that have deployers. */
- private final List deploymentList = new ArrayList();
-
- /** A list of all deployments that do not have deployers. */
- private final List waitingDeployments = new ArrayList();
-
- /** A helper for sorting deployment URLs. */
- private final DeploymentSorter sorter = new DeploymentSorter();
-
- /** A helper for sorting deploymentInfos */
- private final Comparator infoSorter = new DeploymentInfoComparator(sorter);
-
- /** Helper class handling the SuffixOrder and EnhancedSuffixOrder attributes */
- private final SuffixOrderHelper suffixOrderHelper = new SuffixOrderHelper(sorter);
/** Should local copies be made of resources on the local file system */
private boolean copyFiles = true;
@@ -213,36 +192,6 @@
{
return tempDirString;
}
-
- /** Get the ordering of the deployment suffixes
- *
- * @return the ordering of the deployment suffixes
- * @jmx.managed-attribute
- */
- public String[] getSuffixOrder()
- {
- return suffixOrderHelper.getSuffixOrder();
- }
-
- /** Get the enhanced suffix order
- *
- * @return the enhanced suffix order
- * @jmx.managed-attribute
- */
- public String[] getEnhancedSuffixOrder()
- {
- return suffixOrderHelper.getEnhancedSuffixes();
- }
-
- /** Set the enhanced suffix order
- *
- * @param enhancedSuffixOrder the enhanced suffix order
- * @jmx.managed-attribute
- */
- public void setEnhancedSuffixOrder(String[] enhancedSuffixOrder)
- {
- suffixOrderHelper.setEnhancedSuffixes(enhancedSuffixOrder);
- }
/**
* Describe <code>setServiceController</code> method here.
@@ -255,237 +204,6 @@
this.serviceController = serviceController;
}
- /**
- * The <code>listDeployed</code> method returns a collection of DeploymemtInfo
- * objects for the currently deployed packages.
- *
- * @return a <code>Collection</code> value
- * @jmx.managed-operation
- */
- public Collection listDeployed()
- {
- synchronized (deploymentList)
- {
- log.debug("deployment list string: " + deploymentList);
- return new ArrayList(deploymentList);
- }
- }
-
- /**
- * The <code>listDeployedModules</code> method returns a collection of
- * SerializableDeploymentInfo objects for the currently deployed packages.
- *
- * @return a <code>Collection</code> value
- * @jmx.managed-operation
- */
- public Collection listDeployedModules()
- {
- log.debug("listDeployedModules");
-
- HashMap map = new HashMap();
- synchronized (deploymentList)
- {
- Collection col = new ArrayList(deploymentList);
-
- // create a map entry for each deployment
- for (Iterator it = col.iterator(); it.hasNext();)
- {
- DeploymentInfo info = (DeploymentInfo) it.next();
- map.put(info.url, new SerializableDeploymentInfo(info));
- // assign parent and sub deployments
- fillParentAndChildrenSDI(info, map);
- }
- }
-
- // map.values is not serializable, so we copy
- return new ArrayList(map.values());
- }
-
- /**
- * Describe <code>listDeployedAsString</code> method here.
- *
- * @return a <code>String</code> value
- * @jmx.managed-operation
- */
- public String listDeployedAsString()
- {
- return "<pre>" + listDeployed() + "</pre>";
- }
-
- /**
- * The <code>listIncompletelyDeployed</code> method returns a list of packages that have
- * not deployed completely. The toString method will include any exception in the status
- * field.
- *
- * @return a <code>Collection</code> value
- * @jmx.managed-operation
- */
- public Collection listIncompletelyDeployed()
- {
- List id = new ArrayList();
- List copy;
- synchronized (deploymentList)
- {
- copy = new ArrayList(deploymentList);
- }
- for (Iterator i = copy.iterator(); i.hasNext();)
- {
- DeploymentInfo di = (DeploymentInfo)i.next();
- if (!"Deployed".equals(di.status) && !"Starting".equals(di.status))
- {
- id.add(di);
- } // end of if ()
-
- } // end of for ()
- return id;
- }
-
- /**
- * The <code>listWaitingForDeployer</code> method returns a collection
- * of the packages that currently have no identified deployer.
- *
- * @return a <code>Collection</code> value
- * @jmx.managed-operation
- */
- public Collection listWaitingForDeployer()
- {
- synchronized (waitingDeployments)
- {
- return new ArrayList(waitingDeployments);
- }
- }
-
- /**
- * The <code>addDeployer</code> method registers a deployer with the main deployer.
- * Any waiting packages are tested to see if the new deployer will deploy them.
- *
- * @param deployer a <code>SubDeployer</code> value
- * @jmx.managed-operation
- */
- public void addDeployer(final SubDeployer deployer)
- {
- log.debug("Adding deployer: " + deployer);
- ObjectName deployerName = deployer.getServiceName();
-
- synchronized(deployers)
- {
- deployers.addFirst(deployer);
- try
- {
- String[] suffixes = (String[]) server.getAttribute(deployerName, "EnhancedSuffixes");
- suffixOrderHelper.addEnhancedSuffixes(suffixes);
- }
- catch(Exception e)
- {
- log.debug(deployerName + " does not support EnhancedSuffixes");
- suffixOrderHelper.addSuffixes(deployer.getSuffixes(), deployer.getRelativeOrder());
- }
- }
-
- // Send a notification about the deployer addition
- Notification msg = new Notification(ADD_DEPLOYER, this, getNextNotificationSequenceNumber());
- msg.setUserData(deployerName);
- sendNotification(msg);
-
- synchronized (waitingDeployments)
- {
- List copy = new ArrayList(waitingDeployments);
- waitingDeployments.clear();
- for (Iterator i = copy.iterator(); i.hasNext();)
- {
- DeploymentInfo di = (DeploymentInfo)i.next();
- log.debug("trying to deploy with new deployer: " + di.shortName);
- try
- {
- di.setServer(server);
- deploy(di);
- }
- catch (DeploymentException e)
- {
- log.error("DeploymentException while trying to deploy a package with a new deployer", e);
- } // end of try-catch
- } // end of for ()
- }
- }
-
- /**
- * The <code>removeDeployer</code> method unregisters a deployer with the MainDeployer.
- * Deployed packages deployed with this deployer are undeployed.
- *
- * @param deployer a <code>SubDeployer</code> value
- * @jmx.managed-operation
- */
- public void removeDeployer(final SubDeployer deployer)
- {
- log.debug("Removing deployer: " + deployer);
- ObjectName deployerName = deployer.getServiceName();
- boolean removed = false;
-
- synchronized(deployers)
- {
- removed = deployers.remove(deployer);
- try
- {
- String[] suffixes = (String[]) server.getAttribute(deployerName, "EnhancedSuffixes");
- suffixOrderHelper.removeEnhancedSuffixes(suffixes);
- }
- catch(Exception e)
- {
- log.debug(deployerName + " does not support EnhancedSuffixes");
- suffixOrderHelper.removeSuffixes(deployer.getSuffixes(), deployer.getRelativeOrder());
- }
- }
-
- // Send a notification about the deployer removal
- if (removed)
- {
- Notification msg = new Notification(REMOVE_DEPLOYER, this, getNextNotificationSequenceNumber());
- msg.setUserData(deployerName);
- sendNotification(msg);
- }
-
- List copy;
- synchronized (deploymentList)
- {
- copy = new ArrayList(deploymentList);
- }
- for (Iterator i = copy.iterator(); i.hasNext(); )
- {
- DeploymentInfo di = (DeploymentInfo)i.next();
- if (di.deployer == deployer)
- {
- undeploy(di);
- di.deployer = null;
- synchronized (waitingDeployments)
- {
- waitingDeployments.add(di);
- }
- }
- }
- }
-
- /**
- * The <code>listDeployers</code> method returns a collection of ObjectNames of
- * deployers registered with the MainDeployer.
- *
- * @return a <code>Collection<ObjectName></code> value
- * @jmx.managed-operation
- */
- public Collection listDeployers()
- {
- ArrayList deployerNames = new ArrayList();
- synchronized(deployers)
- {
- for(int n = 0; n < deployers.size(); n ++)
- {
- SubDeployer deployer = (SubDeployer) deployers.get(n);
- ObjectName name = deployer.getServiceName();
- deployerNames.add(name);
- }
- }
- return deployerNames;
- }
-
// ServiceMBeanSupport overrides ---------------------------------
protected ObjectName getObjectName(MBeanServer server, ObjectName name)
@@ -513,9 +231,6 @@
// used in inLocalCopyDir
tempDirString = tempDir.toURL().toString();
-
- // handles SuffixOrder & RelativeSuffixOrder attributes
- suffixOrderHelper.initialize();
}
/**
@@ -526,37 +241,7 @@
*/
public void shutdown()
{
- // if we shutdown in the middle of a scan, it still might be possible that we try to redeploy
- // things we are busy killing...
- int deployCounter = 0;
-
- // undeploy everything in sight
- List copy;
- synchronized (deploymentList)
- {
- copy = new ArrayList(deploymentList);
- }
- for (ListIterator i = copy.listIterator(copy.size()); i.hasPrevious(); )
- {
- try
- {
- undeploy((DeploymentInfo)i.previous(), true);
- deployCounter++;
- }
- catch (Exception e)
- {
- log.info("exception trying to undeploy during shutdown", e);
- }
-
- }
- // Help GC
- this.deployers.clear();
- this.deploymentMap.clear();
- this.deploymentList.clear();
- this.waitingDeployments.clear();
this.tempDir = null;
-
- log.debug("Undeployed " + deployCounter + " deployed packages");
}
@@ -588,27 +273,6 @@
}
/**
- * Describe <code>redeploy</code> method here.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx.managed-operation
- */
- public void redeploy(DeploymentInfo sdi) throws DeploymentException
- {
- try
- {
- undeploy(sdi);
- }
- catch (Throwable t)
- {
- log.info("Throwable from undeployment attempt: ", t);
- } // end of try-catch
- sdi.setServer(server);
- deploy(sdi);
- }
-
- /**
* The <code>undeploy</code> method undeploys a package identified by a string
* representation of a URL.
*
@@ -650,119 +314,6 @@
}
/**
- * The <code>undeploy</code> method undeploys a package represented by a
- * DeploymentInfo object.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @jmx.managed-operation
- */
- public void undeploy(DeploymentInfo di)
- {
- undeploy(di, false);
- }
- protected void undeploy(DeploymentInfo di, boolean isShutdown)
- {
- log.debug("Undeploying "+di.url);
- stop(di);
- destroy(di);
- }
-
- /**
- * The <code>stop</code> method is the first internal step of undeployment
- *
- * @param di a <code>DeploymentInfo</code> value
- */
- private void stop(DeploymentInfo di)
- {
- // Stop all sub-deployments
- ArrayList reverseSortedSubs = new ArrayList(di.subDeployments);
- Collections.sort(reverseSortedSubs, infoSorter);
- Collections.reverse(reverseSortedSubs);
- for (Iterator subs = reverseSortedSubs.iterator(); subs.hasNext();)
- {
- DeploymentInfo sub = (DeploymentInfo) subs.next();
- log.debug("Stopping sub deployment: "+sub.url);
- stop(sub);
- }
- // Lastly stop this deployment itself
- try
- {
- // Tell the respective deployer to undeploy this one
- if (di.deployer != null)
- {
- di.deployer.stop(di);
- di.status="Stopped";
- di.state = DeploymentState.STOPPED;
- }
- }
- catch (Throwable t)
- {
- log.error("Deployer stop failed for: " + di.url, t);
- }
-
- }
-
- /**
- * The <code>destroy</code> method is the second and final internal undeployment step.
- *
- * @param di a <code>DeploymentInfo</code> value
- */
- private void destroy(DeploymentInfo di)
- {
- // Destroy all sub-deployments
- ArrayList reverseSortedSubs = new ArrayList(di.subDeployments);
- Collections.sort(reverseSortedSubs, infoSorter);
- Collections.reverse(reverseSortedSubs);
- for (Iterator subs = reverseSortedSubs.iterator(); subs.hasNext();)
- {
- DeploymentInfo sub = (DeploymentInfo) subs.next();
- log.debug("Destroying sub deployment: "+sub.url);
- destroy(sub);
- }
- // Lastly destroy the deployment itself
- try
- {
- // Tell the respective deployer to undeploy this one
- if (di.deployer != null)
- {
- di.deployer.destroy(di);
- di.status="Destroyed";
- di.state = DeploymentState.DESTROYED;
- }
- }
- catch (Throwable t)
- {
- log.error("Deployer destroy failed for: " + di.url, t);
- di.state = DeploymentState.FAILED;
- }
-
- try
- {
- // remove from local maps
- synchronized (deploymentList)
- {
- deploymentMap.remove(di.url);
- if (deploymentList.lastIndexOf(di) != -1)
- {
- deploymentList.remove(deploymentList.lastIndexOf(di));
- }
- }
- synchronized (waitingDeployments)
- {
- waitingDeployments.remove(di);
- }
- // Nuke my stuff, this includes the class loader
- di.cleanup();
-
- log.debug("Undeployed "+di.url);
- }
- catch (Throwable t)
- {
- log.error("Undeployment cleanup failed: " + di.url, t);
- }
- }
-
- /**
* The <code>deploy</code> method deploys a package identified by a
* string representation of a URL.
*
@@ -824,417 +375,6 @@
}
}
- /**
- * The <code>deploy</code> method deploys a package represented by a DeploymentInfo object.
- *
- * @param deployment a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx.managed-operation
- */
- public void deploy(DeploymentInfo deployment)
- throws DeploymentException
- {
- // If we are already deployed return
- if (isDeployed(deployment.url))
- {
- log.info("Package: " + deployment.url + " is already deployed");
- return;
- }
- log.debug("Starting deployment of package: " + deployment.url);
-
- boolean inited = false;
- try
- {
- inited = init(deployment);
- }
- catch (Throwable t)
- {
- log.error("Could not initialise deployment: " + deployment.url, t);
- DeploymentException.rethrowAsDeploymentException("Could not initialise deployment: " + deployment.url, t);
- }
- if ( inited )
- {
- create(deployment);
- start(deployment);
- log.debug("Deployed package: " + deployment.url);
- } // end of if ()
- else
- {
- log.debug("Deployment of package: " + deployment.url + " is waiting for an appropriate deployer.");
- } // end of else
- }
-
-
- /**
- * The <code>init</code> method is the first internal deployment step.
- * The tasks are to copy the code if necessary,
- * set up classloaders, and identify the deployer for the package.
- *
- * @param deployment a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- private boolean init(DeploymentInfo deployment) throws DeploymentException
- {
- // If we are already deployed return
- if (isDeployed(deployment.url))
- {
- log.info("Package: " + deployment.url + " is already deployed");
- return false;
- }
- log.debug("Starting deployment (init step) of package at: " + deployment.url);
- try
- {
- // Create a local copy of that File, the sdi keeps track of the copy directory
- if (deployment.localUrl == null)
- {
- makeLocalCopy(deployment);
- URL[] localCl = new URL[]{deployment.localUrl};
- deployment.localCl = new URLClassLoader(localCl);
- }
-
- // What deployer is able to deploy this file
- findDeployer(deployment);
-
- if(deployment.deployer == null)
- {
- deployment.state = DeploymentState.INIT_WAITING_DEPLOYER;
- log.debug("deployment waiting for deployer: " + deployment.url);
- synchronized (waitingDeployments)
- {
- if (waitingDeployments.contains(deployment) == false)
- waitingDeployments.add(deployment);
- }
- return false;
- }
- deployment.state = DeploymentState.INIT_DEPLOYER;
- //we have the deployer, continue deployment.
- deployment.deployer.init(deployment);
- // initialize the unified classloaders for this deployment
- deployment.createClassLoaders();
- deployment.state = DeploymentState.INITIALIZED;
-
- // Add the deployment to the map so we can detect circular deployments
- synchronized (deploymentList)
- {
- deploymentMap.put(deployment.url, deployment);
- }
-
- // create subdeployments as needed
- parseManifestLibraries(deployment);
-
- log.debug("found " + deployment.subDeployments.size() + " subpackages of " + deployment.url);
- // get sorted subDeployments
- ArrayList sortedSubs = new ArrayList(deployment.subDeployments);
- Collections.sort(sortedSubs, infoSorter);
- for (Iterator lt = sortedSubs.listIterator(); lt.hasNext();)
- {
- init((DeploymentInfo) lt.next());
- }
- }
- catch (Exception e)
- {
- deployment.state = DeploymentState.FAILED;
- DeploymentException.rethrowAsDeploymentException("exception in init of " + deployment.url, e);
- }
- finally
- {
- // whether you do it or not, for the autodeployer
- try
- {
- URL url = deployment.localUrl == null ? deployment.url : deployment.localUrl;
-
- long lastModified = -1;
-
- if (url.getProtocol().equals("file"))
- lastModified = new File(url.getFile()).lastModified();
- else
- lastModified = url.openConnection().getLastModified();
-
- deployment.lastModified=lastModified;
- deployment.lastDeployed=System.currentTimeMillis();
- }
- catch (IOException ignore)
- {
- deployment.lastModified=System.currentTimeMillis();
- deployment.lastDeployed=System.currentTimeMillis();
- }
-
- synchronized (deploymentList)
- {
- // Do we watch it? Watch only urls outside our copy directory.
- if (!inLocalCopyDir(deployment.url) && deploymentList.contains(deployment) == false)
- {
- deploymentList.add(deployment);
- log.debug("Watching new file: " + deployment.url);
- }
- }
- }
- return true;
- }
-
- /**
- * The <code>create</code> method is the second internal deployment step.
- * It should set up all information not
- * requiring other components. for instance, the ejb Container is created,
- * and the proxy bound into jndi.
- *
- * @param deployment a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- private void create(DeploymentInfo deployment) throws DeploymentException
- {
- log.debug("create step for deployment " + deployment.url);
- try
- {
- ArrayList sortedSubs = new ArrayList(deployment.subDeployments);
- Collections.sort(sortedSubs, infoSorter);
- for (Iterator lt = sortedSubs.listIterator(); lt.hasNext();)
- {
- create((DeploymentInfo) lt.next());
- }
- deployment.state = DeploymentState.CREATE_SUBDEPLOYMENTS;
-
- // Deploy this SDI, if it is a deployable type
- if (deployment.deployer != null)
- {
- try
- {
- deployment.state = DeploymentState.CREATE_DEPLOYER;
- deployment.deployer.create(deployment);
- // See if all mbeans are created...
- deployment.state = DeploymentState.CREATED;
- deployment.status="Created";
- log.debug("Done with create step of deploying " + deployment.shortName);
- }
- catch (Throwable t)
- {
- log.error("Could not create deployment: " + deployment.url, t);
- throw t;
- }
- }
- else
- {
- log.debug("Still no deployer for package in create step: " + deployment.shortName);
- } // end of else
- }
- catch (Throwable t)
- {
- log.trace("could not create deployment: " + deployment.url, t);
- deployment.status = "Deployment FAILED reason: " + t.getMessage();
- deployment.state = DeploymentState.FAILED;
- DeploymentException.rethrowAsDeploymentException("Could not create deployment: " + deployment.url, t);
- }
- }
-
- /**
- * The <code>start</code> method is the third and final internal deployment step.
- * The purpose is to set up relationships between components.
- * for instance, ejb links are set up here.
- *
- * @param deployment a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- private void start(DeploymentInfo deployment) throws DeploymentException
- {
- deployment.status = "Starting";
- log.debug("Begin deployment start " + deployment.url);
- try
- {
- ArrayList sortedSubs = new ArrayList(deployment.subDeployments);
- Collections.sort(sortedSubs, infoSorter);
- for (Iterator lt = sortedSubs.listIterator(); lt.hasNext();)
- {
- start((DeploymentInfo) lt.next());
- }
- deployment.state = DeploymentState.START_SUBDEPLOYMENTS;
-
- // Deploy this SDI, if it is a deployable type
- if (deployment.deployer != null)
- {
- try
- {
- deployment.state = DeploymentState.START_DEPLOYER;
- deployment.deployer.start(deployment);
- // See if all mbeans are started...
- Object[] args = {deployment, DeploymentState.STARTED};
- String[] sig = {"org.jboss.deployment.DeploymentInfo",
- "org.jboss.deployment.DeploymentState"};
- server.invoke(serviceController, "validateDeploymentState",args, sig);
- deployment.status = "Deployed";
- log.debug("End deployment start on package: "+ deployment.shortName);
- }
- catch (Throwable t)
- {
- log.error("Could not start deployment: " + deployment.url, t);
- throw t;
- }
- }
- else
- {
- log.debug("Still no deployer for package in start step: " + deployment.shortName);
- } // end of else
- }
- catch (Throwable t)
- {
- log.trace("could not start deployment: " + deployment.url, t);
- deployment.state = DeploymentState.FAILED;
- deployment.status = "Deployment FAILED reason: " + t.getMessage();
- DeploymentException.rethrowAsDeploymentException("Could not create deployment: " + deployment.url, t);
- }
- }
-
- /**
- * The <code>findDeployer</code> method attempts to find a deployer for the DeploymentInfo
- * supplied as a parameter.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- */
- private void findDeployer(DeploymentInfo sdi)
- {
- // If there is already a deployer use it
- if( sdi.deployer != null )
- {
- log.debug("using existing deployer "+sdi.deployer);
- return;
- }
-
- //
- // To deploy directories of beans one should just name the directory
- // mybean.ear/bla...bla, so that the directory gets picked up by the right deployer
- //
- synchronized(deployers)
- {
- for (Iterator iterator = deployers.iterator(); iterator.hasNext(); )
- {
- SubDeployer deployer = (SubDeployer) iterator.next();
- if (deployer.accepts(sdi))
- {
- sdi.deployer = deployer;
- log.debug("using deployer "+deployer);
- return;
- }
- }
- }
- log.debug("No deployer found for url: " + sdi.url);
- }
-
- /**
- * The <code>parseManifestLibraries</code> method looks into the manifest for classpath
- * goo, and tries to deploy referenced packages.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- */
- private void parseManifestLibraries(DeploymentInfo sdi)
- {
- String classPath = null;
-
- Manifest mf = sdi.getManifest();
-
- if( mf != null )
- {
- Attributes mainAttributes = mf.getMainAttributes();
- classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
- }
-
- if (classPath != null)
- {
- StringTokenizer st = new StringTokenizer(classPath);
- log.debug("resolveLibraries: "+classPath);
-
- while (st.hasMoreTokens())
- {
- URL lib = null;
- String tk = st.nextToken();
- log.debug("new manifest entry for sdi at "+sdi.shortName+" entry is "+tk);
-
- try
- {
- if (sdi.isDirectory)
- {
- File parentDir = new File(sdi.url.getPath()).getParentFile();
- lib = new File(parentDir, tk).toURL();
- }
- else
- {
- lib = new URL(sdi.url, tk);
- }
-
- // Only deploy this if it is not already being deployed
- if ( deploymentMap.containsKey(lib) == false )
- {
- /* Test that the only deployer for this is the JARDeployer.
- Any other type of deployment cannot be initiated through
- a manifest reference.
- */
- DeploymentInfo mfRef = new DeploymentInfo(lib, null, getServer());
- makeLocalCopy(mfRef);
- URL[] localURL = {mfRef.localUrl};
- mfRef.localCl = new java.net.URLClassLoader(localURL);
- findDeployer(mfRef);
- SubDeployer deployer = mfRef.deployer;
- if(deployer != null && (deployer instanceof JARDeployer) == false)
- {
- // Its a non-jar deployment that must be deployed seperately
- log.warn("Found non-jar deployer for " + tk + ": " + deployer);
- }
-
- // add the library
- sdi.addLibraryJar(lib);
- }
- }
- catch (Exception ignore)
- {
- log.debug("The manifest entry in "+sdi.url+" references URL "+lib+
- " which could not be opened, entry ignored", ignore);
- }
- }
- }
- }
-
- /**
- * Downloads the jar file or directory the src URL points to.
- * In case of directory it becomes packed to a jar file.
- */
- private void makeLocalCopy(DeploymentInfo sdi)
- {
- try
- {
- if (sdi.url.getProtocol().equals("file") && (!copyFiles || sdi.isDirectory))
- {
- // If local copies have been disabled, do nothing
- sdi.localUrl = sdi.url;
- return;
- }
- // Are we already in the localCopyDir?
- else if (inLocalCopyDir(sdi.url))
- {
- sdi.localUrl = sdi.url;
- return;
- }
- else
- {
- String shortName = sdi.shortName;
- File localFile = File.createTempFile("tmp", shortName, tempDir);
- sdi.localUrl = localFile.toURL();
- copy(sdi.url, localFile);
- }
- }
- catch (Exception e)
- {
- log.error("Could not make local copy for " + sdi.url, e);
- }
- }
-
- private boolean inLocalCopyDir(URL url)
- {
- int i = 0;
- String urlTest = url.toString();
- if( urlTest.startsWith("jar:") )
- i = 4;
-
- return urlTest.startsWith(tempDirString, i);
- }
-
protected void copy(URL src, File dest) throws IOException
{
log.debug("Copying " + src + " -> " + dest);
@@ -1279,30 +419,6 @@
}
/**
- * The <code>start</code> method starts a package identified by a URL
- *
- * @param urlspec an <code>URL</code> value
- * @jmx.managed-operation
- */
- public void start(String urlspec)
- throws DeploymentException, MalformedURLException
- {
- throw new DeploymentException("Not supported");
- }
-
- /**
- * The <code>stop</code> method stops a package identified by a URL
- *
- * @param urlspec an <code>URL</code> value
- * @jmx.managed-operation
- */
- public void stop(String urlspec)
- throws DeploymentException, MalformedURLException
- {
- throw new DeploymentException("Not supported");
- }
-
- /**
* The <code>isDeployed</code> method tells you if a package identified by a string
* representation of a URL is currently deployed.
*
@@ -1446,33 +562,4 @@
throw new DeploymentException("Deployments are incomplete", e);
}
}
-
- /**
- * @param parent
- * @param map
- */
- private void fillParentAndChildrenSDI(DeploymentInfo parent, Map map)
- {
- Set subDeployments = parent.subDeployments;
- Iterator it = subDeployments.iterator();
- while (it.hasNext())
- {
- DeploymentInfo child = (DeploymentInfo) it.next();
- SerializableDeploymentInfo sdichild = returnSDI(child, map);
- sdichild.parent = returnSDI(parent, map);
- sdichild.parent.subDeployments.add(sdichild);
- fillParentAndChildrenSDI(child, map);
- }
- }
-
- private SerializableDeploymentInfo returnSDI(DeploymentInfo di, Map map)
- {
- SerializableDeploymentInfo sdi = (SerializableDeploymentInfo) map.get(di.url);
- if( sdi == null )
- {
- sdi = new SerializableDeploymentInfo(di);
- map.put(di.url, sdi);
- }
- return sdi;
- }
}
Modified: trunk/system-jmx/src/main/org/jboss/deployment/MainDeployerMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/MainDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/MainDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -62,80 +62,16 @@
/** The path to the local tmp directory */
File getTempDir();
void setTempDir(File tempDir);
-
- /** The enhanced suffix order */
- String[] getEnhancedSuffixOrder();
- void setEnhancedSuffixOrder(String[] enhancedSuffixOrder);
/** The ObjectName of the ServiceController */
void setServiceController(ObjectName serviceController);
/** The path to the local tmp directory in String form */
String getTempDirString();
-
- /** The ordering of the deployment suffixes */
- String[] getSuffixOrder();
// Operations ----------------------------------------------------
/**
- * The <code>listDeployed</code> method returns a collection of
- * DeploymemtInfo objects for the currently deployed packages.
- * @return a <code>Collection</code> value
- */
- Collection listDeployed();
-
- /**
- * The <code>listDeployedModules</code> method returns a collection of
- * SerializableDeploymentInfo objects for the currently deployed packages.
- * @return a <code>Collection</code> value
- */
- Collection listDeployedModules();
-
- /**
- * Describe <code>listDeployedAsString</code> method here.
- * @return a <code>String</code> value
- */
- String listDeployedAsString();
-
- /**
- * The <code>listIncompletelyDeployed</code> method returns a list of
- * packages that have not deployed completely. The toString method will
- * include any exception in the status field.
- * @return a <code>Collection</code> value
- */
- Collection listIncompletelyDeployed();
-
- /**
- * The <code>listWaitingForDeployer</code> method returns a collection of
- * the packages that currently have no identified deployer.
- * @return a <code>Collection</code> value
- */
- Collection listWaitingForDeployer();
-
- /**
- * The <code>addDeployer</code> method registers a deployer with the
- * main deployer. Any waiting packages are tested to see if the new
- * deployer will deploy them.
- * @param deployer a <code>SubDeployer</code> value
- */
- void addDeployer(SubDeployer deployer);
-
- /**
- * The <code>removeDeployer</code> method unregisters a deployer with the
- * MainDeployer. Deployed packages deployed with this deployer are undeployed.
- * @param deployer a <code>SubDeployer</code> value
- */
- void removeDeployer(SubDeployer deployer);
-
- /**
- * The <code>listDeployers</code> method returns a collection of ObjectNames
- * of deployers registered with the MainDeployer.
- * @return a <code>Collection<ObjectName></code> value
- */
- Collection listDeployers();
-
- /**
* The <code>shutdown</code> method undeploys all deployed packages
* in reverse order of their deployement.
*/
@@ -157,13 +93,6 @@
void redeploy(URL url) throws DeploymentException;
/**
- * Describe <code>redeploy</code> method here.
- * @param sdi a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- */
- void redeploy(DeploymentInfo sdi) throws DeploymentException;
-
- /**
* The <code>undeploy</code> method undeploys a package identified by a URL
* @param url an <code>URL</code> value
*/
@@ -177,12 +106,6 @@
void undeploy(String urlspec) throws DeploymentException, MalformedURLException;
/**
- * The <code>undeploy</code> method undeploys a package represented by a DeploymentInfo object.
- * @param di a <code>DeploymentInfo</code> value
- */
- void undeploy(DeploymentInfo di);
-
- /**
* The <code>deploy</code> method deploys a package identified by a string representation of a URL.
* @param urlspec a <code>String</code> value
* @exception java.net.MalformedURLException if an error occurs
@@ -196,27 +119,6 @@
void deploy(URL url) throws DeploymentException;
/**
- * The <code>deploy</code> method deploys a package represented by a DeploymentInfo object.
- * @param deployment a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- */
- void deploy(DeploymentInfo deployment) throws DeploymentException;
-
- /**
- * The <code>start</code> method starts a package identified by a URL
- * @param urlspec an URL string value
- * @jmx.managed-operation
- */
- public void start(String urlspec) throws DeploymentException, MalformedURLException;
-
- /**
- * The <code>stop</code> method stop a package identified by a URL
- * @param urlspec an URL string value
- * @jmx.managed-operation
- */
- public void stop(String urlspec) throws DeploymentException, MalformedURLException;
-
- /**
* The <code>isDeployed</code> method tells you if a package identified
* by a string representation of a URL is currently deployed.
* @param url a <code>String</code> value
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/ObjectModelFactorySimpleSubDeployerSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/ObjectModelFactorySimpleSubDeployerSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/ObjectModelFactorySimpleSubDeployerSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.net.URL;
-
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-/**
- * A simple subdeployer that deploys a managed object after parsing the
- * deployment's xml file using an ObjectModelFactory.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public abstract class ObjectModelFactorySimpleSubDeployerSupport extends SimpleSubDeployerSupport
-{
- /**
- * Get the object model factory
- *
- * @return the object model factory
- */
- public abstract ObjectModelFactory getObjectModelFactory();
-
- protected void parseMetaData(DeploymentInfo di, URL url) throws DeploymentException
- {
- try
- {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = getObjectModelFactory();
- Object root = null;
- di.metaData = unmarshaller.unmarshal(url.toString(), factory, root);
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error parsing meta data " + url, t);
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SARDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SARDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SARDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,719 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.mx.loading.LoaderRepositoryFactory;
-import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.net.protocol.URLLister;
-import org.jboss.net.protocol.URLListerFactory;
-import org.jboss.system.ServiceControllerMBean;
-import org.jboss.system.server.ServerConfigLocator;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.util.Strings;
-import org.jboss.util.stream.Streams;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
-
-/**
- * This is the main Service Deployer API.
- *
- * @see org.jboss.system.Service
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:David.Maplesden at orion.co.nz">David Maplesden</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis<a/>
- * @version $Revision$
- */
-public class SARDeployer extends SubDeployerSupport
- implements SARDeployerMBean
-{
- /** The suffixes we accept, along with their relative order */
- private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] {
- "050:.deployer",
- "050:-deployer.xml",
- "150:.sar",
- "150:-service.xml"
- };
-
- /** The deployment descriptor to look for */
- private static final String JBOSS_SERVICE = "META-INF/jboss-service.xml";
-
- /** A proxy to the ServiceController. */
- private ServiceControllerMBean serviceController;
-
- /** The server data directory. */
- private File dataDir;
-
- /** The server configuration base URL. For example,
- file:/<jboss_dist_root>/server/default. Relative service
- descriptor codebase elements are relative to this URL.
- */
- private URL serverHomeURL;
-
- /** A HashMap<ObjectName, DeploymentInfo> for the deployed services */
- private HashMap serviceDeploymentMap = new HashMap();
-
- /**
- * A Map<String, List<String>> of the suffix to accepted archive META-INF descriptor name
- * @todo externalize this
- */
- private Map suffixToDescriptorMap = new ConcurrentReaderHashMap();
-
- /** A flag indicating if the parser used for the service descriptor should be configured for namespaces */
- private boolean useNamespaceAwareParser;
-
- /**
- * Default CTOR
- */
- public SARDeployer()
- {
- setEnhancedSuffixes(DEFAULT_ENHANCED_SUFFIXES);
- // Add the .har to META-INF/{jboss-service.xml,hibernate-service.xml} mapping
- ArrayList tmp = new ArrayList();
- tmp.add(JBOSS_SERVICE);
- tmp.add("META-INF/hibernate-service.xml");
- suffixToDescriptorMap.put(".har", tmp);
- }
-
- public boolean isUseNamespaceAwareParser()
- {
- return useNamespaceAwareParser;
- }
-
- public void setUseNamespaceAwareParser(boolean useNamespaceAwareParser)
- {
- this.useNamespaceAwareParser = useNamespaceAwareParser;
- }
-
- /**
- * Get the associated service DeploymentInfo if found, null otherwise
- *
- * @param serviceName a service object name
- * @return The associated service DeploymentInfo if found, null otherwise
- * @jmx.managed-operation
- */
- public DeploymentInfo getService(ObjectName serviceName)
- {
- DeploymentInfo di = null;
- synchronized( serviceDeploymentMap )
- {
- di = (DeploymentInfo) serviceDeploymentMap.get(serviceName);
- }
- return di;
- }
-
- /**
- * Describe <code>init</code> method here.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx.managed-operation
- */
- public void init(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- if (di.url.getPath().endsWith("/"))
- {
- // the URL is a unpacked collection, watch the deployment descriptor
- di.watch = new URL(di.url, JBOSS_SERVICE);
- }
- else
- {
- // just watch the original URL
- di.watch = di.url;
- }
-
- // Get the document if not already present
- parseDocument(di);
-
- // Check for a custom loader-repository for scoping
- NodeList loaders = di.document.getElementsByTagName("loader-repository");
- if( loaders.getLength() > 0 )
- {
- Element loader = (Element) loaders.item(0);
- LoaderRepositoryConfig config = LoaderRepositoryFactory.parseRepositoryConfig(loader);
- di.setRepositoryInfo(config);
- }
-
- // In case there is a dependent classpath defined parse it
- parseXMLClasspath(di);
-
- // Copy local directory if local-directory element is present
- NodeList lds = di.document.getElementsByTagName("local-directory");
- log.debug("about to copy " + lds.getLength() + " local directories");
-
- for (int i = 0; i< lds.getLength(); i++)
- {
- Element ld = (Element)lds.item(i);
- String path = ld.getAttribute("path");
- log.debug("about to copy local directory at " + path);
-
- // Get the url of the local copy from the classloader.
- log.debug("copying from " + di.localUrl + path + " -> " + dataDir);
-
- inflateJar(di.localUrl, dataDir, path);
- }
- }
- catch (DeploymentException de)
- {
- throw de;
- }
- catch (Exception e)
- {
- throw new DeploymentException(e);
- }
-
- // invoke super-class initialization
- super.init(di);
- }
-
- /**
- * Describe <code>create</code> method here.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx.managed-operation
- */
- public void create(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- // install the MBeans in this descriptor
- log.debug("Deploying SAR, create step: url " + di.url);
-
- // Register the SAR UCL as an mbean so we can use it as the service loader
- ObjectName uclName = di.ucl.getObjectName();
- if( getServer().isRegistered(uclName) == false )
- {
- log.debug("Registering service UCL="+uclName);
- getServer().registerMBean(di.ucl, uclName);
- }
-
- List mbeans = di.mbeans;
- mbeans.clear();
- List descriptorMbeans = serviceController.install(di.document.getDocumentElement(), uclName);
- mbeans.addAll(descriptorMbeans);
-
- // create the services
- for (Iterator iter = di.mbeans.iterator(); iter.hasNext(); )
- {
- ObjectName service = (ObjectName)iter.next();
-
- // The service won't be created until explicitly dependent mbeans are created
- serviceController.create(service);
- synchronized( this.serviceDeploymentMap )
- {
- serviceDeploymentMap.put(service, di);
- }
- }
-
- // Generate a JMX notification for the create stage
- super.create(di);
- }
- catch(DeploymentException e)
- {
- log.debug("create operation failed for package "+ di.url, e);
- destroy(di);
- throw e;
- }
- catch (Exception e)
- {
- log.debug("create operation failed for package "+ di.url, e);
- destroy(di);
- throw new DeploymentException("create operation failed for package "
- + di.url, e);
- }
- }
-
- /**
- * The <code>start</code> method starts all the mbeans in this DeploymentInfo..
- *
- * @param di a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx.managed-operation
- */
- public void start(DeploymentInfo di) throws DeploymentException
- {
- log.debug("Deploying SAR, start step: url " + di.url);
- try
- {
- // start the services
-
- for (Iterator iter = di.mbeans.iterator(); iter.hasNext(); )
- {
- ObjectName service = (ObjectName)iter.next();
-
- // The service won't be started until explicitely dependent mbeans are started
- serviceController.start(service);
- }
- // Generate a JMX notification for the start stage
- super.start(di);
- }
- catch (Exception e)
- {
- stop(di);
- destroy(di);
- throw new DeploymentException("start operation failed on package "
- + di.url, e);
- }
- }
-
- /** The stop method invokes stop on the mbeans associatedw ith the deployment
- * in reverse order relative to create.
- *
- * @param di the <code>DeploymentInfo</code> value to stop.
- * @jmx.managed-operation
- */
- public void stop(DeploymentInfo di)
- {
- log.debug("undeploying document " + di.url);
-
- List services = di.mbeans;
- int lastService = services.size();
-
- // stop services in reverse order.
- for (ListIterator i = services.listIterator(lastService); i.hasPrevious();)
- {
- ObjectName name = (ObjectName)i.previous();
- log.debug("stopping mbean " + name);
- try
- {
- serviceController.stop(name);
- }
- catch (Exception e)
- {
- log.error("Could not stop mbean: " + name, e);
- } // end of try-catch
- }
-
- // Generate a JMX notification for the stop stage
- try
- {
- super.stop(di);
- }
- catch(Exception ignore)
- {
- }
- }
-
- /** The destroy method invokes destroy on the mbeans associated with
- * the deployment in reverse order relative to create.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @jmx.managed-operation
- */
- public void destroy(DeploymentInfo di)
- {
- List services = di.mbeans;
- int lastService = services.size();
-
- for (ListIterator i = services.listIterator(lastService); i.hasPrevious();)
- {
- ObjectName name = (ObjectName)i.previous();
- log.debug("destroying mbean " + name);
- synchronized( serviceDeploymentMap )
- {
- serviceDeploymentMap.remove(name);
- }
-
- try
- {
- serviceController.destroy(name);
- }
- catch (Exception e)
- {
- log.error("Could not destroy mbean: " + name, e);
- } // end of try-catch
- }
-
- for (ListIterator i = services.listIterator(lastService); i.hasPrevious();)
- {
- ObjectName name = (ObjectName)i.previous();
- log.debug("removing mbean " + name);
- try
- {
- serviceController.remove(name);
- }
- catch (Exception e)
- {
- log.error("Could not remove mbean: " + name, e);
- } // end of try-catch
- }
-
- // Unregister the SAR UCL
- try
- {
- ObjectName uclName = di.ucl.getObjectName();
- if( getServer().isRegistered(uclName) == true )
- {
- log.debug("Unregistering service UCL="+uclName);
- getServer().unregisterMBean(uclName);
- }
- }
- catch(Exception ignore)
- {
- }
-
- // Generate a JMX notification for the destroy stage
- try
- {
- super.destroy(di);
- }
- catch(Exception ignore)
- {
- }
- }
-
- // ServiceMBeanSupport overrides --------------------------------
-
- /**
- * The startService method gets the mbeanProxies for MainDeployer
- * and ServiceController, used elsewhere.
- *
- * @exception Exception if an error occurs
- */
- protected void startService() throws Exception
- {
- super.startService();
-
- // get the controller proxy
- serviceController = (ServiceControllerMBean)
- MBeanProxyExt.create(ServiceControllerMBean.class,
- ServiceControllerMBean.OBJECT_NAME, server);
-
- // Get the data directory, install url & library url
- ServerConfig config = ServerConfigLocator.locate();
- dataDir = config.getServerDataDir();
- serverHomeURL = config.getServerHomeURL();
- }
-
- /**
- * This method stops all the applications in this server.
- */
- protected void stopService() throws Exception
- {
- // deregister with MainDeployer
- super.stopService();
-
- // Help GC
- serviceController = null;
- serverHomeURL = null;
- dataDir = null;
- }
-
-
- protected ObjectName getObjectName(MBeanServer server, ObjectName name)
- throws MalformedObjectNameException
- {
- return name == null ? OBJECT_NAME : name;
- }
-
- // Protected -----------------------------------------------------
-
- protected File[] listFiles(final String urlspec) throws Exception
- {
- URL url = Strings.toURL(urlspec);
-
- // url is already canonical thanks to Strings.toURL
- File dir = new File(url.getFile());
-
- File[] files = dir.listFiles(new java.io.FileFilter()
- {
- public boolean accept(File pathname)
- {
- String name = pathname.getName().toLowerCase();
- return (name.endsWith(".jar") || name.endsWith(".zip"));
- }
- });
-
- return files;
- }
-
- /**
- * @param di
- * @throws Exception
- */
- protected void parseXMLClasspath(DeploymentInfo di)
- throws Exception
- {
- ArrayList classpath = new ArrayList();
- URLListerFactory listerFactory = new URLListerFactory();
-
- NodeList children = di.document.getDocumentElement().getChildNodes();
- for (int i = 0; i < children.getLength(); i++)
- {
- if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
- {
- Element classpathElement = (Element)children.item(i);
- if (classpathElement.getTagName().equals("classpath"))
- {
- log.debug("Found classpath element: " + classpathElement);
- if (!classpathElement.hasAttribute("codebase"))
- {
- throw new DeploymentException
- ("Invalid classpath element missing codebase: " + classpathElement);
- }
- String codebase = classpathElement.getAttribute("codebase").trim();
- // Replace any system property references like ${x}
- codebase = StringPropertyReplacer.replaceProperties(codebase);
-
- String archives = null;
- if (classpathElement.hasAttribute("archives"))
- {
- archives = classpathElement.getAttribute("archives").trim();
- // Replace any system property references like ${x}
- archives = StringPropertyReplacer.replaceProperties(archives);
- if ("".equals(archives))
- {
- archives = null;
- }
- }
-
- // Convert codebase to a URL
- // "." is resolved relative to the deployment
- // other URLs are resolved relative to SERVER_HOME
- URL codebaseUrl;
- if (".".equals(codebase))
- {
- codebaseUrl = new URL(di.url, "./");
- }
- else
- {
- if (archives != null && codebase.endsWith("/") == false)
- {
- codebase += "/";
- }
- codebaseUrl = new URL(serverHomeURL, codebase);
- }
- log.debug("codebase URL is " + codebaseUrl);
-
- if (archives == null)
- {
- // archives not supplied so add the codebase itself
- classpath.add(codebaseUrl);
- log.debug("added codebase to classpath");
- }
- else
- {
- // obtain a URLLister for the codebase and use it to obtain
- // the list of URLs to add
- log.debug("listing codebase for archives matching " + archives);
- URLLister lister = listerFactory.createURLLister(codebaseUrl);
- log.debug("URLLister class is " + lister.getClass().getName());
- classpath.addAll(lister.listMembers(codebaseUrl, archives));
- }
- } // end of if ()
-
- } // end of if ()
- } //end of for
-
- // Ok, now we've found the list of urls we need... deploy their classes.
- Iterator jars = classpath.iterator();
- while (jars.hasNext())
- {
- URL neededURL = (URL) jars.next();
- di.addLibraryJar(neededURL);
- log.debug("deployed classes for " + neededURL);
- }
- }
-
- /** Parse the META-INF/jboss-service.xml descriptor
- */
- protected void parseDocument(DeploymentInfo di)
- throws Exception
- {
- InputStream stream = null;
- try
- {
- if (di.document == null)
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(useNamespaceAwareParser);
- DocumentBuilder parser = factory.newDocumentBuilder();
- URL docURL = di.localUrl;
- URLClassLoader localCL = di.localCl;
- // Load jboss-service.xml from the jar or directory
- if (di.isXML == false)
- {
- // Check the suffix to descriptor mapping
- String[] descriptors = getDescriptorName(di);
- for(int n = 0; n < descriptors.length; n ++)
- {
- String descriptor = descriptors[n];
- docURL = localCL.findResource(descriptor);
- if( docURL != null )
- {
- // If this is a unpacked deployment, update the watch url
- if (di.url.getPath().endsWith("/"))
- {
- di.watch = new URL(di.url, descriptor);
- log.debug("Updated watch URL to: "+di.watch);
- }
- break;
- }
- }
- // No descriptors, use the default META-INF/jboss-service.xml
- if( docURL == null )
- docURL = localCL.findResource(JBOSS_SERVICE);
- }
- // Validate that the descriptor was found
- if (docURL == null)
- throw new DeploymentException("Failed to find META-INF/jboss-service.xml for archive " + di.shortName);
-
- stream = docURL.openStream();
- InputSource is = new InputSource(stream);
- is.setSystemId(docURL.toString());
- parser.setEntityResolver(new JBossEntityResolver());
- di.document = parser.parse(is);
- }
- else
- {
- log.debug("Using existing deployment.document");
- }
- }
- finally
- {
- // Close the stream to get around "Too many open files"-errors
- try
- {
- stream.close();
- }
- catch (Exception ignore)
- {
- }
- }
- }
-
- /**
- * The <code>inflateJar</code> copies the jar entries
- * from the jar url jarUrl to the directory destDir.
- * It can be used on the whole jar, a directory, or
- * a specific file in the jar.
- *
- * @param url the <code>URL</code> if the directory or entry to copy.
- * @param destDir the <code>File</code> value of the directory in which to
- * place the inflated copies.
- *
- * @exception DeploymentException if an error occurs
- * @exception IOException if an error occurs
- */
- protected void inflateJar(URL url, File destDir, String path)
- throws DeploymentException, IOException
- {
- String filename = url.getFile();
- JarFile jarFile = new JarFile(filename);
- try
- {
- for (Enumeration e = jarFile.entries(); e.hasMoreElements(); )
- {
- JarEntry entry = (JarEntry)e.nextElement();
- String name = entry.getName();
-
- if (path == null || name.startsWith(path))
- {
- File outFile = new File(destDir, name);
- if (!outFile.exists())
- {
- if (entry.isDirectory())
- {
- outFile.mkdirs();
- }
- else
- {
- Streams.copyb(jarFile.getInputStream(entry),
- new FileOutputStream(outFile));
- }
- } // end of if (outFile.exists())
- } // end of if (matches path)
- }
- }
- finally
- {
- jarFile.close();
- }
- }
-
- // Private -------------------------------------------------------
-
- /**
- * Parse the deployment url for its suffix and return a list of the accepted service
- * descriptor names to look for.
- *
- * @param sdi - the sar deployment info
- * @return the array of sar archive/directory relative names of the service descriptor. If
- * there is no suffix to descriptor mapping, the default of {JBOSS_SERVICE} will be
- * returned.
- */
- private String[] getDescriptorName(DeploymentInfo sdi)
- {
- String[] descriptorNames = {JBOSS_SERVICE};
- String shortName = sdi.shortName;
- int dot = shortName.lastIndexOf('.');
- if( dot >= 0 )
- {
- String suffix = shortName.substring(dot);
- List descriptors = (List) suffixToDescriptorMap.get(suffix);
- if( descriptors != null )
- {
- descriptorNames = new String[descriptors.size()];
- descriptors.toArray(descriptorNames);
- }
- }
- return descriptorNames;
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SARDeployerMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SARDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SARDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * MBean interface.
- */
-public interface SARDeployerMBean extends SubDeployerExtMBean
-{
- /** The default object name */
- ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:service=ServiceDeployer");
-
- // Operations ----------------------------------------------------
-
- /**
- * Get the associated service DeploymentInfo if found, null otherwise
- *
- * @param serviceName a service object name
- * @return The associated service DeploymentInfo if found, null otherwise
- */
- DeploymentInfo getService(ObjectName serviceName);
-
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SchemaBindingSimpleSubDeployerSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SchemaBindingSimpleSubDeployerSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SchemaBindingSimpleSubDeployerSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.net.URL;
-
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-
-/**
- * A simple subdeployer that deploys a managed object after parsing the
- * deployment's xml file using an SchemaBinding.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public abstract class SchemaBindingSimpleSubDeployerSupport extends SimpleSubDeployerSupport
-{
- /** The unmarshaller factory */
- private UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
-
- /**
- * Get the schema binding
- *
- * @return the schema binding
- */
- public abstract SchemaBinding getSchemaBinding();
-
- protected void parseMetaData(DeploymentInfo di, URL url) throws DeploymentException
- {
- try
- {
- Unmarshaller unmarshaller = factory.newUnmarshaller();
- di.metaData = unmarshaller.unmarshal(url.toString(), getSchemaBinding());
- if (di.metaData == null)
- throw new RuntimeException("The xml " + url + " is not well formed!");
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error parsing meta data " + url, t);
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SchemaResolverSimpleSubDeployerSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SchemaResolverSimpleSubDeployerSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SchemaResolverSimpleSubDeployerSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.net.URL;
-
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-
-/**
- * A simple subdeployer that deploys a managed object after parsing the
- * deployment's xml file using the SingletonSchemaResolverFactory.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public abstract class SchemaResolverSimpleSubDeployerSupport extends SimpleSubDeployerSupport
-{
- /** The unmarshaller factory */
- private UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
-
- /** The resolver */
- private SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
-
- protected void parseMetaData(DeploymentInfo di, URL url) throws DeploymentException
- {
- try
- {
- Unmarshaller unmarshaller = factory.newUnmarshaller();
- di.metaData = unmarshaller.unmarshal(url.toString(), resolver);
- if (di.metaData == null)
- throw new RuntimeException("The xml " + url + " is not well formed!");
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error parsing meta data " + url, t);
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SerializableDeploymentInfo.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SerializableDeploymentInfo.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SerializableDeploymentInfo.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,134 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-// $Id$
-
-import javax.management.ObjectName;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-/**
- * DeploymentInfo for remote access by the DeploymentManager.
- * It provides a serializable subset of the information available in DeploymentInfo.
- *
- * @author thomas.diesler at jboss.org
- * @version $Revision$
- */
-public class SerializableDeploymentInfo implements Serializable
-{
- /** @since 4.0.2 */
- private static final long serialVersionUID = -3847995513551913798L;
-
- // The initial construction timestamp
- public Date date;
- // The URL identifing this SDI
- public URL url;
- // An optional URL to a local copy of the deployment
- public URL localUrl;
- // The URL used to watch for changes when the deployment is unpacked
- public URL watch;
- // The suffix of the deployment url
- public String shortName;
- // The last system time the deployment inited by the MainDeployer
- public long lastDeployed;
- // Use for "should we redeploy failed"
- public long lastModified;
- // A free form status for the "state" can be Deployed/failed etc etc
- public String status;
- // The current state of the deployment
- public DeploymentState state;
- // The subdeployer that handles the deployment
- public ObjectName deployer;
- // The classpath declared by this xml descriptor, needs <classpath> entry
- public Collection classpath = new ArrayList();
- // The mbeans deployed
- public List mbeans;
- // Anyone can have subdeployments
- public List subDeployments;
- // And the subDeployments have a parent
- public SerializableDeploymentInfo parent;
- // the web root context in case of war file
- public String webContext;
- // An optional URL to the URL of the document loaded
- public URL documentUrl;
- // Is this a stand-alone service descriptor
- public boolean isXML;
- public boolean isScript;
- // Does the deployment url point to a directory
- public boolean isDirectory;
- // Can contain the MBean that is created through the deployment
- public ObjectName deployedObject;
-
- // Constructors *****************************************************************************************************
-
- /**
- * Construct this object from a DeploymentInfo
- */
- public SerializableDeploymentInfo(DeploymentInfo info)
- {
- this.date = info.date;
- this.url = info.url;
- this.localUrl = info.localUrl;
- this.watch = info.watch;
- this.shortName = info.shortName;
- this.lastDeployed = info.lastDeployed;
- this.lastModified = info.lastModified;
- this.status = info.status;
- this.state = info.state;
- this.deployer = info.deployer.getServiceName();
- this.classpath = info.classpath;
- this.mbeans = info.mbeans;
- this.webContext = info.webContext;
- this.documentUrl = info.documentUrl;
- this.isXML = info.isXML;
- this.isScript = info.isScript;
- this.isDirectory = info.isDirectory;
- this.deployedObject = info.deployedObject;
-
- // we do these in a second iteration
- this.parent = null;
- this.subDeployments = new ArrayList();
- }
-
- /**
- * Returns a string representation of the object.
- */
- public String toString()
- {
- StringBuffer s = new StringBuffer(super.toString());
- s.append(" { url=" + url + " }\n");
- s.append(" deployer: " + deployer + "\n");
- s.append(" status: " + status + "\n");
- s.append(" state: " + state + "\n");
- s.append(" watch: " + watch + "\n");
- s.append(" lastDeployed: " + lastDeployed + "\n");
- s.append(" lastModified: " + lastModified + "\n");
- s.append(" mbeans: " + mbeans + "\n");
- s.append(" }\n");
- return s.toString();
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SimpleSubDeployerSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SimpleSubDeployerSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SimpleSubDeployerSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,408 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.io.File;
-import java.net.URL;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.jboss.mx.loading.RepositoryClassLoader;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.system.ServiceControllerMBean;
-
-/**
- * A simple subdeployer that deploys a managed object after parsing the
- * deployment's xml file.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public abstract class SimpleSubDeployerSupport extends SubDeployerSupport
-{
- /** A proxy to the ServiceController. */
- private ServiceControllerMBean serviceController;
-
- /** Whether we registered the classloader */
- private boolean registeredClassLoader = false;
-
- /**
- * Get the package extension for this deployment
- *
- * @return the package extension
- */
- public abstract String getExtension();
-
- /**
- * Get the metadata url
- *
- * @return the meta data url
- */
- public abstract String getMetaDataURL();
-
- /**
- * Get the object name for this deployment
- *
- * @param di the deployment info
- * @return the object name
- */
- public abstract String getObjectName(DeploymentInfo di) throws DeploymentException;
-
- /**
- * Get the deployment class
- *
- * @return the deployment class
- */
- public abstract String getDeploymentClass();
-
- public boolean accepts(DeploymentInfo di)
- {
- String urlStr = di.url.toString();
- String extension = getExtension();
- return urlStr.endsWith(extension) || urlStr.endsWith(extension + '/');
- }
-
- public void init(DeploymentInfo di) throws DeploymentException
- {
- URL url = getMetaDataResource(di);
- parseMetaData(di, url);
- resolveWatch(di, url);
- super.init(di);
- }
-
- public void create(DeploymentInfo di) throws DeploymentException
- {
- determineObjectName(di);
- ObjectName uclName = registerClassLoader(di);
- try
- {
- registerDeployment(di, uclName);
- try
- {
- createService(di);
- try
- {
- super.create(di);
- }
- catch (Throwable t)
- {
- destroyService(di);
- }
- }
- catch (Throwable t)
- {
- unregisterDeployment(di);
- throw t;
- }
- }
- catch (Throwable t)
- {
- unregisterClassLoader(di);
- DeploymentException.rethrowAsDeploymentException("Error creating deployment " + di.url, t);
- }
- }
-
- public void start(DeploymentInfo di) throws DeploymentException
- {
- startService(di);
- try
- {
- super.start(di);
- }
- catch (Throwable t)
- {
- stopService(di);
- DeploymentException.rethrowAsDeploymentException("Error in start for deployment " + di.url, t);
- }
- }
-
- public void stop(DeploymentInfo di) throws DeploymentException
- {
- stopService(di);
- super.stop(di);
- }
-
- public void destroy(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- destroyService(di);
- super.destroy(di);
- }
- finally
- {
- unregisterDeployment(di);
- unregisterClassLoader(di);
- }
- }
-
- public void postRegister(Boolean done)
- {
- super.postRegister(done);
-
- if (done.booleanValue())
- {
- serviceController = (ServiceControllerMBean)
- MBeanProxyExt.create(ServiceControllerMBean.class,
- ServiceControllerMBean.OBJECT_NAME,
- server);
- }
- }
-
- /**
- * Get the url of the meta data resource
- *
- * @param di the deployment info
- * @return the url of the meta data resource
- * @throws DeploymentException for any error
- */
- protected URL getMetaDataResource(DeploymentInfo di) throws DeploymentException
- {
- URL url = di.localCl.findResource(getMetaDataURL());
- if (url == null)
- throw new DeploymentException("Could not find meta data " + getMetaDataURL() + " for deployment " + di.url);
- return url;
- }
-
- /**
- * Parse the meta data
- *
- * @param di the deployment info
- * @param url the location of the meta data
- * @throws DeploymentException for any error
- */
- abstract protected void parseMetaData(DeploymentInfo di, URL url) throws DeploymentException;
-
- /**
- * Resolve the watch url
- *
- * @param di the deployment info
- * @param url the location of the meta data
- * @throws DeploymentException for any error
- */
- protected void resolveWatch(DeploymentInfo di, URL url) throws DeploymentException
- {
- // Assume we watch the main deployment
- di.watch = di.url;
-
- // Unless it is an unpacked directory
- if (di.url.getProtocol().equals("file"))
- {
- File file = new File(di.url.getFile());
- if (file.isDirectory())
- di.watch = url;
- }
- }
-
- /**
- * Determine the object name
- *
- * @param di the deployment info
- * @throws DeploymentException for any error
- */
- protected void determineObjectName(DeploymentInfo di) throws DeploymentException
- {
- String objectName = getObjectName(di);
- try
- {
- di.deployedObject = new ObjectName(objectName);
- }
- catch (MalformedObjectNameException e)
- {
- throw new DeploymentException("INTERNAL ERROR: Bad object name. " + objectName);
- }
- }
-
- /**
- * Register the UCL classloader
- *
- * @param di the deployment info
- * @return the object name of the classloader
- * @throws DeploymentException for any error
- */
- protected ObjectName registerClassLoader(DeploymentInfo di) throws DeploymentException
- {
- ObjectName uclName = null;
- try
- {
- RepositoryClassLoader ucl = di.ucl;
- uclName = ucl.getObjectName();
- if (server.isRegistered(uclName) == false)
- {
- server.registerMBean(di.ucl, uclName);
- registeredClassLoader = true;
- }
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error registering classloader " + uclName, t);
- }
- return uclName;
- }
-
- /**
- * Unregister the UCL classloader
- *
- * @param di the deployment info
- */
- protected void unregisterClassLoader(DeploymentInfo di)
- {
- ObjectName uclName = null;
- try
- {
- RepositoryClassLoader ucl = di.ucl;
- if (ucl != null)
- {
- uclName = ucl.getObjectName();
- if (registeredClassLoader && server.isRegistered(uclName))
- {
- server.unregisterMBean(uclName);
- registeredClassLoader = false;
- }
- }
- }
- catch (Throwable t)
- {
- log.warn("Error unregistering classloader " + uclName, t);
- }
- }
-
- /**
- * Register the deployment
- *
- * @param di the deployment info
- * @param uclName the object name of the classloader
- * @throws DeploymentException for any error
- */
- protected void registerDeployment(DeploymentInfo di, ObjectName uclName) throws DeploymentException
- {
- try
- {
- String deploymentClass = getDeploymentClass();
- server.createMBean(deploymentClass, di.deployedObject, uclName, new Object[] { di }, new String[] { DeploymentInfo.class.getName() });
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error registering deployment " + di.url, t);
- }
- }
-
- /**
- * Unregister the deployment
- *
- * @param di the deployment info
- */
- protected void unregisterDeployment(DeploymentInfo di)
- {
- try
- {
- if (server.isRegistered(di.deployedObject))
- server.unregisterMBean(di.deployedObject);
- }
- catch (Throwable t)
- {
- log.warn("Error unregistering deployment " + di.deployedObject, t);
- }
- }
-
- /**
- * Do the create lifecyle for the deployment
- *
- * @param di the deployment info
- * @throws DeploymentException for any error
- */
- protected void createService(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- serviceController.create(di.deployedObject);
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error in create for deployment " + di.url, t);
- }
- }
-
- /**
- * Do the start lifecyle for the deployment
- *
- * @param di the deployment info
- * @throws DeploymentException for any error
- */
- protected void startService(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- serviceController.start(di.deployedObject);
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error in start for deployment " + di.url, t);
- }
- }
-
- /**
- * Do the stop lifecyle for the deployment
- *
- * @param di the deployment info
- */
- protected void stopService(DeploymentInfo di)
- {
- try
- {
- if (di.deployedObject != null)
- serviceController.stop(di.deployedObject);
- }
- catch (Throwable t)
- {
- log.warn("Error in stop for deployment " + di.url, t);
- }
- }
-
- /**
- * Do the destroy lifecyle for the deployment
- *
- * @param di the deployment info
- */
- protected void destroyService(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- if (di.deployedObject != null)
- serviceController.destroy(di.deployedObject);
- }
- catch (Throwable t)
- {
- log.warn("Error in destroy for deployment " + di.url, t);
- }
- try
- {
- if (di.deployedObject != null)
- serviceController.remove(di.deployedObject);
- }
- catch (Throwable t)
- {
- log.warn("Error in remove for deployment " + di.url, t);
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import javax.management.ObjectName;
-
-/**
- * The common interface for sub-deployer components which
- * perform the actual deployment services for application
- * components.
- *
- * @jmx:mbean extends="org.jboss.system.ServiceMBean"
- *
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:toby.allsopp at peace.com">Toby Allsopp</a>
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- */
-public interface SubDeployer
-{
- /** The notification type send when a SubDeployer completes init */
- public static final String INIT_NOTIFICATION = "org.jboss.deployment.SubDeployer.init";
- /** The notification type send when a SubDeployer completes create */
- public static final String CREATE_NOTIFICATION = "org.jboss.deployment.SubDeployer.create";
- /** The notification type send when a SubDeployer completes start */
- public static final String START_NOTIFICATION = "org.jboss.deployment.SubDeployer.start";
- /** The notification type send when a SubDeployer completes stop */
- public static final String STOP_NOTIFICATION = "org.jboss.deployment.SubDeployer.stop";
- /** The notification type send when a SubDeployer completes destroy */
- public static final String DESTROY_NOTIFICATION = "org.jboss.deployment.SubDeployer.destroy";
-
- /**
- * Get the JMX ObjectName of the service that provides the SubDeployer
- * @return JMX ObjectName of the service
- *
- * @jmx:managed-attribute
- */
- public ObjectName getServiceName();
-
- /**
- * Get an array of suffixes of interest to this subdeployer
- * @return array of suffix strings
- *
- * @jmx:managed-attribute
- */
- public String[] getSuffixes();
-
- /**
- * Get the relative order of the specified suffixes
- * @return the relative order of the specified suffixes
- *
- * @jmx:managed-attribute
- */
- public int getRelativeOrder();
-
- /**
- * The <code>accepts</code> method is called by MainDeployer to
- * determine which deployer is suitable for a DeploymentInfo.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @return a <code>boolean</code> value
- *
- * @jmx:managed-operation
- */
- boolean accepts(DeploymentInfo sdi);
-
- /**
- * The <code>init</code> method lets the deployer set a few properties
- * of the DeploymentInfo, such as the watch url.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- *
- * @jmx:managed-operation
- */
- void init(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * Set up the components of the deployment that do not
- * refer to other components
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- *
- * @jmx:managed-operation
- */
- void create(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * The <code>start</code> method sets up relationships with other components.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- *
- * @jmx:managed-operation
- */
- void start(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * The <code>stop</code> method removes relationships between components.
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- *
- * @jmx:managed-operation
- */
- void stop(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * The <code>destroy</code> method removes individual components
- *
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- *
- * @jmx:managed-operation
- */
- void destroy(DeploymentInfo sdi) throws DeploymentException;
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExt.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExt.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExt.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-/**
- * An extension interface that allows the retrieval
- * and setting of the combined suffixes and their relative
- * order supported by a SubDeployer.
- *
- * The syntax of an enhanced suffix is
- *
- * "order:suffix"
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public interface SubDeployerExt extends SubDeployer
-{
- /**
- * The list of supported suffixes
- * and their relative order.
- */
- void setEnhancedSuffixes(String[] enhancedSuffixes);
- String[] getEnhancedSuffixes();
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExtMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExtMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerExtMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-/**
- * An extension mbean interface that allows the retrieval
- * and setting of the combined suffixes and their relative
- * order supported by a SubDeployer.
- *
- * The syntax of an enhanced suffix is
- *
- * "order:suffix"
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public interface SubDeployerExtMBean extends SubDeployerMBean
-{
- /**
- * The list of enhanced suffixes
- */
- void setEnhancedSuffixes(String[] enhancedSuffixes);
- String[] getEnhancedSuffixes();
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptor.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptor.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptor.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import org.jboss.mx.interceptor.AbstractInterceptor;
-import org.jboss.mx.interceptor.Interceptor;
-import org.jboss.mx.server.Invocation;
-
-/**
- * Base class for SubDeployer interceptors.
- *
- * Override one or more of the init(), create(), start(), stop(), destroy()
- * methods to add behaviour. Don't forget to call invokeNext() inside
- * your implementation, if you want the call to be continued.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public abstract class SubDeployerInterceptor extends AbstractInterceptor
-{
- // Constructors --------------------------------------------------
-
- /**
- * Default CTOR
- */
- public SubDeployerInterceptor()
- {
- super();
- }
-
- /**
- * CTOR
- *
- * @param name - the name to use for this interceptor
- */
- public SubDeployerInterceptor(String name)
- {
- // invoker is unknown
- super(name);
- }
-
- // Interceptor implementation ------------------------------------
-
- /**
- * This invoke method checks for invocations of interest, .i.e.
- * init(), create(), start(), stop(), destroy() operation calls
- * with a single DeploymentInfo argument and wraps the invocation
- * with calls to corresponding init(), create(), etc. methods.
- */
- public Object invoke(Invocation invocation) throws Throwable
- {
- String type = invocation.getType();
-
- // make sure this is an operation invocation
- if (type.equals(Invocation.OP_INVOKE))
- {
- Object args[] = invocation.getArgs();
- Object retn = invocation.getReturnTypeClass();
-
- // make sure the signature matches -> void <methodName>(DeploymentInfo di)
- if ((args.length == 1) && (args[0] instanceof DeploymentInfo) && (retn == null))
- {
- String method = invocation.getName();
- DeploymentInfo di = (DeploymentInfo)args[0];
-
- if (method.equals("init"))
- {
- return init(invocation, di);
- }
- else if (method.equals("create"))
- {
- return create(invocation, di);
- }
- else if (method.equals("start"))
- {
- return start(invocation, di);
- }
- else if (method.equals("stop"))
- {
- return stop(invocation, di);
- }
- else if (method.equals("destroy"))
- {
- return destroy(invocation, di);
- }
- }
- }
- // if we reached this point invocation is of no interest
- // to SubDeployerInterceptor so simply forward it
- return invokeNext(invocation);
- }
-
- // Protected -----------------------------------------------------
-
- /**
- * Use this to forward the call
- */
- protected Object invokeNext(Invocation invocation) throws Throwable
- {
- // call the next in the interceptor chain,
- // if nobody follows dispatch the call
- Interceptor next = invocation.nextInterceptor();
- if (next != null)
- {
- return next.invoke(invocation);
- }
- else
- {
- return invocation.dispatch();
- }
- }
-
- // Protected overrides -------------------------------------------
-
- // Override the following methods to add behaviour. Remember
- // to call invokeNext() if you want the call to proceed.
-
- protected Object init(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- protected Object create(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- protected Object start(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- protected Object stop(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- protected Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
-}
\ No newline at end of file
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import org.jboss.system.InterceptorServiceMBean;
-
-/**
- * Interface for SubDeployerInterceptor services.
- *
- * Empty since we inherit the Interceptable
- * settings from InterceptorServiceMBean.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public interface SubDeployerInterceptorMBean extends InterceptorServiceMBean
-{
- // Empty
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerInterceptorSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,220 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.server.Invocation;
-import org.jboss.system.InterceptorServiceMBeanSupport;
-
-/**
- * Base class that can be used for writing services
- * that dynamically hook to other interceptable deployers
- * in order to add functionality in the deployment cycle.
- *
- * We override attach() to install a different interceptor
- * from that of the base class that understands SubDeployer
- * calls. Note that the baseclass invoke(Invocation) won't be
- * called, so no need to override it.
- *
- * Simply call attach()/detach() from createService()/destroyService()
- * or startService()/stopService() pair methods to attach/detach the
- * interceptor to the configured Interceptable SubDeployer(s).
- * Then override any of the init/create/start/stop/destroy methods to
- * apply the extra interception functionality. Inside those methods
- * don't forget to forward the call using invokeNext().
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public abstract class SubDeployerInterceptorSupport extends InterceptorServiceMBeanSupport
- implements SubDeployerInterceptorMBean
-{
-
- // Constructors -------------------------------------------------
-
- /**
- * Constructs an <tt>SubDeployerInterceptorSupport</tt>.
- */
- public SubDeployerInterceptorSupport()
- {
- super();
- }
-
- /**
- * Constructs an <tt>SubDeployerInterceptorSupport</tt>.
- *
- * Pass-through to InterceptorServiceMBeanSupport.
- *
- * @param type The class type to determine Logger name from.
- */
- public SubDeployerInterceptorSupport(final Class type)
- {
- super(type);
- }
-
- /**
- * Constructs an <tt>SubDeployerInterceptorSupport</tt>.
- *
- * Pass-through to InterceptorServiceMBeanSupport.
- *
- * @param category The logger category name.
- */
- public SubDeployerInterceptorSupport(final String category)
- {
- super(category);
- }
-
- /**
- * Constructs an <tt>SubDeployerInterceptorSupport</tt>.
- *
- * Pass-through to InterceptorServiceMBeanSupport.
- *
- * @param log The logger to use.
- */
- public SubDeployerInterceptorSupport(final Logger log)
- {
- super(log);
- }
-
- // Protected API -------------------------------------------------
-
- /**
- * We override attach() from InterceptorServiceMBeanSupport
- * to attach a different interceptor that knows how to switch
- * init/create/start/stop/destroy SubDeployer calls.
- *
- * @throws Exception thrown on any interceptor registration error
- */
- protected void attach() throws Exception
- {
- super.attach(new XMBeanInterceptor());
- }
-
- // Override ------------------------------------------------------
-
- /**
- * Override
- */
- protected Object init(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- /**
- * Override
- */
- protected Object create(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- /**
- * Override
- */
- protected Object start(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- /**
- * Override
- */
- protected Object stop(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- /**
- * Override
- */
- protected Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- return invokeNext(invocation);
- }
-
- // Private Inner Class -------------------------------------------
-
- /**
- * Simple SubDeployerInterceptor delegating to
- * the SubDeployerInterceptorSupport callbacks
- */
- private class XMBeanInterceptor extends SubDeployerInterceptor
- {
- public XMBeanInterceptor()
- {
- super("XMBeanInterceptor('" + SubDeployerInterceptorSupport.this.getServiceName() + "')");
- }
-
- protected Object init(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- logSubDeployerInvocation(invocation, di);
-
- // delegate
- return SubDeployerInterceptorSupport.this.init(invocation, di);
- }
-
- protected Object create(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- logSubDeployerInvocation(invocation, di);
-
- // delegate
- return SubDeployerInterceptorSupport.this.create(invocation, di);
- }
-
- protected Object start(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- logSubDeployerInvocation(invocation, di);
-
- // delegate
- return SubDeployerInterceptorSupport.this.start(invocation, di);
- }
-
- protected Object stop(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- logSubDeployerInvocation(invocation, di);
-
- // delegate
- return SubDeployerInterceptorSupport.this.stop(invocation, di);
- }
-
- protected Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable
- {
- logSubDeployerInvocation(invocation, di);
-
- // delegate
- return SubDeployerInterceptorSupport.this.destroy(invocation, di);
- }
-
- protected void logSubDeployerInvocation(Invocation invocation, DeploymentInfo di)
- {
- if (SubDeployerInterceptorSupport.this.log.isTraceEnabled())
- {
- StringBuffer sbuf = new StringBuffer();
- sbuf.append("intercepting ").append(invocation.getName())
- .append("(), url=").append(di.url.toString())
- .append(", state=").append(di.state.toString());
-
- SubDeployerInterceptorSupport.this.log.trace(sbuf.toString());
- }
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import javax.management.ObjectName;
-
-import org.jboss.system.ServiceMBean;
-
-/**
- * MBean interface for SubDeployers
- *
- * @version <tt>$Revision$</tt>
- */
-public interface SubDeployerMBean extends ServiceMBean
-{
- // Attributes ----------------------------------------------------
-
- /**
- * Get the JMX ObjectName of the service that provides the SubDeployer
- * @return JMX ObjectName of the service
- */
- ObjectName getServiceName();
-
- /**
- * Get an array of suffixes of interest to this subdeployer
- * @return array of suffix strings
- */
- String[] getSuffixes();
-
- /**
- * Get the relative order of the specified suffixes
- * @return the relative order of the specified suffixes
- */
- int getRelativeOrder();
-
- // Operations ----------------------------------------------------
-
- /**
- * The <code>accepts</code> method is called by MainDeployer
- * to determine which deployer is suitable for a DeploymentInfo.
- * @param sdi a <code>DeploymentInfo</code> value
- * @return a <code>boolean</code> value
- */
- boolean accepts(DeploymentInfo sdi);
-
- /**
- * The <code>init</code> method lets the deployer set a few
- * properties of the DeploymentInfo, such as the watch url.
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- void init(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * Set up the components of the deployment that do not
- * refer to other components.
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- void create(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * The <code>start</code> method sets up relationships
- * with other components.
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- void start(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * The <code>stop</code> method removes relationships
- * between components.
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- void stop(DeploymentInfo sdi) throws DeploymentException;
-
- /**
- * The <code>destroy</code> method removes individual
- * components
- * @param sdi a <code>DeploymentInfo</code> value
- * @throws DeploymentException if an error occurs
- */
- void destroy(DeploymentInfo sdi) throws DeploymentException;
-
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SubDeployerSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,618 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import javax.management.Notification;
-
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.bootstrap.spi.util.ServerConfigUtil;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.system.ServiceMBeanSupport;
-import org.jboss.system.server.ServerConfigLocator;
-import org.jboss.util.file.JarUtils;
-import org.jboss.util.stream.Streams;
-
-/**
- * An abstract {@link SubDeployer}.
- *
- * Provides registration with {@link MainDeployer} as well as
- * implementations of init, create, start, stop and destroy that
- * generate JMX notifications on completion of the method.
- *
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- */
-public abstract class SubDeployerSupport extends ServiceMBeanSupport
- implements SubDeployerExt, SubDeployerExtMBean
-{
- /**
- * Holds the native library <em>suffix</em> for this system.
- *
- * Determined by examining the result of System.mapLibraryName(specialToken).
- * The special token defaults to "XxX", but can be changed by setting the
- * system property: <tt>org.jboss.deployment.SubDeployerSupport.nativeLibToken</tt>.
- */
- protected static final String nativeSuffix;
-
- /**
- * Holds the native library <em>prefix</em> for this system.
- *
- * @see #nativeSuffix
- */
- protected static final String nativePrefix;
-
- /** A proxy to the MainDeployer. */
- protected MainDeployerMBean mainDeployer;
-
- /** The temporary directory into which deployments are unpacked */
- protected File tempDeployDir;
-
- /** The list of enhancedSuffixes for this subdeployer */
- protected String[] enhancedSuffixes;
-
- /** The suffixes of interest to this subdeployer */
- protected String[] suffixes;
-
- /** The relative order of this subdeployer - not really used */
- protected int relativeOrder = -1;
-
- /** The temporary directory where native libs are unpacked. */
- private File tempNativeDir;
-
- /** Whether to load native libraries */
- private boolean loadNative = false;
-
- /**
- * The <code>createService</code> method is one of the ServiceMBean lifecyle operations.
- * (no jmx tag needed from superinterface)
- *
- * @exception Exception if an error occurs
- */
- protected void createService() throws Exception
- {
- // get the temporary directories to use
- ServerConfig config = ServerConfigLocator.locate();
- tempNativeDir = config.getServerNativeDir();
- tempDeployDir = config.getServerTempDeployDir();
- loadNative = ServerConfigUtil.isLoadNative();
-
- // Setup the proxy to mainDeployer
- mainDeployer = (MainDeployerMBean)
- MBeanProxyExt.create(MainDeployerMBean.class,
- MainDeployerMBean.OBJECT_NAME,
- server);
- }
-
- /**
- * Performs SubDeployer registration.
- */
- protected void startService() throws Exception
- {
- // Register with the main deployer
- mainDeployer.addDeployer(this);
- }
-
- /**
- * Performs SubDeployer deregistration.
- */
- protected void stopService() throws Exception
- {
- // Unregister with the main deployer
- mainDeployer.removeDeployer(this);
- }
-
- /**
- * Clean up.
- */
- protected void destroyService() throws Exception
- {
- // Help the GC
- mainDeployer = null;
- tempNativeDir = null;
- }
-
- /**
- * Set an array of suffixes of interest to this subdeployer.
- * No need to register twice suffixes that may refer to
- * unpacked deployments (e.g. .sar, .sar/).
- *
- * @param suffixes array of suffix strings
- */
- protected void setSuffixes(String[] suffixes)
- {
- this.suffixes = suffixes;
- }
-
- /**
- * Set the relative order of the specified suffixes
- * all to the same value.
- *
- * @param relativeOrder the relative order of the specified suffixes
- */
- protected void setRelativeOrder(int relativeOrder)
- {
- this.relativeOrder = relativeOrder;
- }
-
- /**
- * Set the enhanced suffixes list for this deployer,
- * causing also the supported suffixes list to be updated.
- *
- * Each enhanced suffix entries has the form:
- *
- * [order:]suffix
- *
- * No need to register twice suffixes that may refer to
- * unpacked deployments (e.g. .sar, .sar/).
- *
- * @param enhancedSuffixes
- */
- public void setEnhancedSuffixes(String[] enhancedSuffixes)
- {
- if (enhancedSuffixes != null)
- {
- int len = enhancedSuffixes.length;
- suffixes = new String[len];
-
- for (int i = 0; i < len; i++)
- {
- // parse each enhancedSuffix
- SuffixOrderHelper.EnhancedSuffix e =
- new SuffixOrderHelper.EnhancedSuffix(enhancedSuffixes[i]);
-
- suffixes[i] = e.suffix;
- }
- }
- this.enhancedSuffixes = enhancedSuffixes;
- }
-
- /**
- * Get an array of enhancedSuffixes
- *
- * @return array of enhanced suffix strings
- */
- public String[] getEnhancedSuffixes()
- {
- return enhancedSuffixes;
- }
-
- /**
- * Get an array of suffixes of interest to this subdeployer
- *
- * @return array of suffix strings
- */
- public String[] getSuffixes()
- {
- return suffixes;
- }
-
- /**
- * Get the relative order of the specified suffixes
- *
- * @return the relative order of the specified suffixes
- */
- public int getRelativeOrder()
- {
- return relativeOrder;
- }
-
- /**
- * A default implementation that uses the suffixes registered
- * through either setSuffixes() or setEnhancedSuffixes(), to
- * decide if a module is deployable by this deployer.
- *
- * If (according to DeploymentInfo) the deployment refers to
- * a directory, but not an xml or script deployment, then
- * the deployment suffix will be checked also against the
- * registered suffixes + "/".
- *
- * @param sdi the DeploymentInfo to check
- * @return whether the deployer can handle the deployment
- */
- public boolean accepts(DeploymentInfo sdi)
- {
- String[] acceptedSuffixes = getSuffixes();
- if (acceptedSuffixes == null)
- {
- return false;
- }
- else
- {
- String urlPath = sdi.url.getPath();
- String shortName = sdi.shortName;
- boolean checkDir = sdi.isDirectory && !(sdi.isXML || sdi.isScript);
-
- for (int i = 0; i < acceptedSuffixes.length; i++)
- {
- // First check the urlPath the might end in "/"
- // then check the shortName where "/" is removed
- if (urlPath.endsWith(acceptedSuffixes[i]) ||
- (checkDir && shortName.endsWith(acceptedSuffixes[i])))
- {
- return true;
- }
- }
- return false;
- }
- }
-
- /**
- * Sub-classes should override this method to provide
- * custom 'init' logic.
- *
- * <p>This method calls the processNestedDeployments(di) method and then
- * issues a JMX notification of type SubDeployer.INIT_NOTIFICATION.
- * This behaviour can overridden by concrete sub-classes. If further
- * initialization needs to be done, and you wish to preserve the
- * functionality, be sure to call super.init(di) at the end of your
- * implementation.
- */
- public void init(DeploymentInfo di) throws DeploymentException
- {
- processNestedDeployments(di);
-
- emitNotification(SubDeployer.INIT_NOTIFICATION, di);
- }
-
- /**
- * Sub-classes should override this method to provide
- * custom 'create' logic.
- *
- * This method issues a JMX notification of type SubDeployer.CREATE_NOTIFICATION.
- */
- public void create(DeploymentInfo di) throws DeploymentException
- {
- emitNotification(SubDeployer.CREATE_NOTIFICATION, di);
- }
-
- /**
- * Sub-classes should override this method to provide
- * custom 'start' logic.
- *
- * This method issues a JMX notification of type SubDeployer.START_NOTIFICATION.
- */
- public void start(DeploymentInfo di) throws DeploymentException
- {
- emitNotification(SubDeployer.START_NOTIFICATION, di);
- }
-
- /**
- * Sub-classes should override this method to provide
- * custom 'stop' logic.
- *
- * This method issues a JMX notification of type SubDeployer.START_NOTIFICATION.
- */
- public void stop(DeploymentInfo di) throws DeploymentException
- {
- emitNotification(SubDeployer.STOP_NOTIFICATION, di);
- }
-
- /**
- * Sub-classes should override this method to provide
- * custom 'destroy' logic.
- *
- * This method issues a JMX notification of type SubDeployer.DESTROY_NOTIFICATION.
- */
- public void destroy(DeploymentInfo di) throws DeploymentException
- {
- emitNotification(SubDeployer.DESTROY_NOTIFICATION, di);
- }
-
- /**
- * Simple helper to emit a subdeployer notification containing DeploymentInfo
- */
- protected void emitNotification(String type, DeploymentInfo di)
- {
- Notification notification = new Notification(type, this, getNextNotificationSequenceNumber());
- notification.setUserData(di);
- sendNotification(notification);
- }
-
- /**
- * The <code>processNestedDeployments</code> method searches for any nested and
- * deployable elements. Only Directories and Zipped archives are processed,
- * and those are delegated to the addDeployableFiles and addDeployableJar
- * methods respectively. This method can be overridden for alternate
- * behaviour.
- */
- protected void processNestedDeployments(DeploymentInfo di) throws DeploymentException
- {
- log.debug("looking for nested deployments in : " + di.url);
- if (di.isXML)
- {
- // no nested archives in an xml file
- return;
- }
-
- if (di.isDirectory)
- {
- File f = new File(di.url.getFile());
- if (!f.isDirectory())
- {
- // something is screwy
- throw new DeploymentException
- ("Deploy file incorrectly reported as a directory: " + di.url);
- }
-
- addDeployableFiles(di, f);
- }
- else
- {
- try
- {
- // Obtain a jar url for the nested jar
- URL nestedURL = JarUtils.extractNestedJar(di.localUrl, this.tempDeployDir);
- JarFile jarFile = new JarFile(nestedURL.getFile());
- addDeployableJar(di, jarFile);
- }
- catch (Exception e)
- {
- log.warn("Failed to add deployable jar: " + di.localUrl, e);
-
- //
- // jason: should probably throw new DeploymentException
- // ("Failed to add deployable jar: " + jarURLString, e);
- // rather than make assumptions to what type of deployable
- // file this was that failed...
- //
-
- return;
- }
- }
- }
-
- /**
- * This method returns true if the name is a recognized archive file.
- *
- * It will query the MainDeployer that keeps a dynamically updated
- * list of known archive extensions.
- *
- * @param name The "short-name" of the URL. It will have any trailing '/'
- * characters removed, and any directory structure has been removed.
- * @param url The full url.
- *
- * @return true iff the name ends in a known archive extension: .jar, .sar,
- * .ear, .rar, .zip, .wsr, .war, or if the name matches the native
- * library conventions.
- */
- protected boolean isDeployable(String name, URL url)
- {
- // any file under META-INF is not deployable; this method is called
- // also for zipped content, e.g. dir1/dir2.sar/META-INF/bla.xml
- if (url.getPath().indexOf("META-INF") != -1)
- {
- return false;
- }
- String[] acceptedSuffixes = mainDeployer.getSuffixOrder();
- for (int i = 0; i < acceptedSuffixes.length; i++)
- {
- if (name.endsWith(acceptedSuffixes[i]))
- {
- return true;
- }
- }
- // this is probably obsolete
- return (name.endsWith(nativeSuffix) && name.startsWith(nativePrefix));
- }
-
- /**
- * This method recursively searches the directory structure for any files
- * that are deployable (@see isDeployable). If a directory is found to
- * be deployable, then its subfiles and subdirectories are not searched.
- *
- * @param di the DeploymentInfo
- * @param dir The root directory to start searching.
- */
- protected void addDeployableFiles(DeploymentInfo di, File dir)
- throws DeploymentException
- {
- File[] files = dir.listFiles();
- for (int i = 0; i < files.length; i++)
- {
- File file = files[i];
- String name = file.getName();
- try
- {
- URL url = file.toURL();
- if (isDeployable(name, url))
- {
- deployUrl(di, url, name);
- // we don't want deployable units processed any further
- continue;
- }
- }
- catch (MalformedURLException e)
- {
- log.warn("File name invalid; ignoring: " + file, e);
- }
- if (file.isDirectory())
- {
- addDeployableFiles(di, file);
- }
- }
- }
-
- /**
- * This method searches the entire jar file for any deployable files
- * (@see isDeployable).
- *
- * @param di the DeploymentInfo
- * @param jarFile the jar file to process.
- */
- protected void addDeployableJar(DeploymentInfo di, JarFile jarFile)
- throws DeploymentException
- {
- String urlPrefix = "jar:"+di.localUrl.toString()+"!/";
- for (Enumeration e = jarFile.entries(); e.hasMoreElements();)
- {
- JarEntry entry = (JarEntry)e.nextElement();
- String name = entry.getName();
- try
- {
- URL url = new URL(urlPrefix+name);
- if (isDeployable(name, url))
- {
- // Obtain a jar url for the nested jar
- URL nestedURL = JarUtils.extractNestedJar(url, this.tempDeployDir);
- deployUrl(di, nestedURL, name);
- }
- }
- catch (MalformedURLException mue)
- {
- //
- // jason: why are we eating this exception?
- //
- log.warn("Jar entry invalid; ignoring: " + name, mue);
- }
- catch (IOException ex)
- {
- log.warn("Failed to extract nested jar; ignoring: " + name, ex);
- }
- }
- }
-
- protected void deployUrl(DeploymentInfo di, URL url, String name)
- throws DeploymentException
- {
- log.debug("nested deployment: " + url);
- try
- {
- //
- // jason: need better handling for os/arch specific libraries
- // should be able to have multipule native libs in an archive
- // one for each supported platform (os/arch), we only want to
- // load the one for the current platform.
- //
- // This probably means explitly listing the libraries in a
- // deployment descriptor, which could probably also be used
- // to explicitly map the files, as it might be possible to
- // share a native lib between more than one version, no need
- // to duplicate the file, metadata can be used to tell us
- // what needs to be done.
- //
- // Also need this mapping to get around the different values
- // which are used by vm vendors for os.arch and such...
- //
-
- if (name.endsWith(nativeSuffix) && name.startsWith(nativePrefix))
- {
- File destFile = new File(tempNativeDir, name);
- log.info("Loading native library: " + destFile.toString());
-
- File parent = destFile.getParentFile();
- if (!parent.exists()) {
- parent.mkdirs();
- }
-
- InputStream in = url.openStream();
- OutputStream out = new FileOutputStream(destFile);
- Streams.copyb(in, out);
-
- out.flush();
- out.close();
- in.close();
-
- if (loadNative)
- System.load(destFile.toString());
- }
- else
- {
- new DeploymentInfo(url, di, getServer());
- }
- }
- catch (Exception ex)
- {
- throw new DeploymentException
- ("Could not deploy sub deployment "+name+" of deployment "+di.url, ex);
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Class Property Configuration //
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * Static configuration properties for this class. Allows easy access
- * to change defaults with system properties.
- */
- protected static class ClassConfiguration
- extends org.jboss.util.property.PropertyContainer
- {
- private String nativeLibToken = "XxX";
-
- public ClassConfiguration()
- {
- // properties will be settable under our enclosing classes group
- super(SubDeployerSupport.class);
-
- // bind the properties & the access methods
- bindMethod("nativeLibToken");
- }
-
- public void setNativeLibToken(final String token)
- {
- this.nativeLibToken = token;
- }
-
- public String getNativeLibToken()
- {
- return nativeLibToken;
- }
- }
-
- /** The singleton class configuration object for this class. */
- protected static final ClassConfiguration CONFIGURATION = new ClassConfiguration();
-
- //
- // jason: the following needs to be done after setting up the
- // class config reference, so it is moved it down here.
- //
-
- /**
- * Determine the native library suffix and prefix.
- */
- static
- {
- // get the token to use from config, incase the default needs
- // to be changed to resolve problem with a specific platform
- String token = CONFIGURATION.getNativeLibToken();
-
- // then determine what the prefix and suffixes are for this platform
- String nativex = System.mapLibraryName(token);
- int xPos = nativex.indexOf(token);
- nativePrefix = nativex.substring(0, xPos);
- nativeSuffix = nativex.substring(xPos + 3);
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/SuffixOrderHelper.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/SuffixOrderHelper.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/SuffixOrderHelper.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,459 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.jboss.logging.Logger;
-
-/**
- * SuffixOrderHelper.
- *
- * This class wraps the SuffixOrder and EnhandedSuffixes attributes
- * of MainDeployer.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public final class SuffixOrderHelper
-{
- // Constants -----------------------------------------------------
-
- /**
- * Default EnhancedSuffixes
- *
- * Those values are indicative - we just know they'll work with
- * the compiled order of subdeployers like the aop or ejb3,
- * but any order can be set using the EnhancedSuffixes
- * attribute and/or the individual subdeployer's relative order.
- *
- * The commented out entries indicate those are dynamically
- * added by their respective subdeployers when they register.
- */
- public static final String[] DEFAULT_ENHANCED_SUFFIXES = {};
- /*
- Moved this list to org.jboss.deployment.MainDeployer-xmbean.xml
- so there are no hardcoded defaults.
- {
- //"050:.deployer",
- //"050:-deployer.xml",
- //"100:.aop",
- //"100:-aop.xml",
- //"150:.sar",
- //"150:-service.xml",
- //"200:.beans",
- "250:.rar",
- "300:-ds.xml",
- //"350:.har",
- "400:.jar", // ejb .jar
- //"450:.ejb3",
- //"450:.par",
- "500:.war", // don't comment out this!
- "600:.wsr",
- "650:.ear",
- //"700:.jar", // plain .jar
- //"750:.zip",
- "800:.bsh",
- "900:.last" // the JARDeployer really handles those?
- };
- */
-
- /** A default relative order just before 900:.last */
- public static final int DEFAULT_RELATIVE_ORDER = 850;
-
- /** The Logger */
- public static final Logger log = Logger.getLogger(SuffixOrderHelper.class);
-
- // Private Data --------------------------------------------------
-
- /** Wrapped DeploymentSorter that stores the value for SuffixOrder attribute */
- private final DeploymentSorter sorter;
-
- /** The actual value of EnhancedSuffixes attribute */
- private String[] enhancedSuffixes;
-
- /** List of sorted EnhancedSuffix instances */
- private List suffixes;
-
- /** Set of static String suffixes that cannot be overriden/removed */
- private Set staticSuffixes;
-
- // Constructor ---------------------------------------------------
-
- public SuffixOrderHelper(DeploymentSorter sorter)
- {
- this.sorter = sorter;
- this.suffixes = new ArrayList();
- this.staticSuffixes = new HashSet();
- }
-
- // Accessors -----------------------------------------------------
-
- /**
- * Getter only for the SuffixOrder as known by the MainDeployer and the Scanners
- *
- * The value is updated during init() with suffixes that remain constant.
- * After that suffixes are added/removed using the corresponding methods.
- *
- * @return the SuffixOrder string array
- */
- public String[] getSuffixOrder()
- {
- return sorter.getSuffixOrder();
- }
-
- /**
- * Getter for the EnhancedSuffixes attribute
- *
- * @return the EnhancedSuffixes string array
- */
- public String[] getEnhancedSuffixes()
- {
- return enhancedSuffixes;
- }
-
- /**
- * Setter for the EnhancedSuffixes attribute
- *
- * @param enhancedSuffixes the EnhancedSuffixes string array
- */
- public void setEnhancedSuffixes(String[] enhancedSuffixes)
- {
- this.enhancedSuffixes = enhancedSuffixes;
- }
-
- /**
- * Initialise the SuffixOrder from EnhancedSuffixes.
- *
- * If no enchangedSuffixes is specified, DEFAULT_ENHANCED_SUFFIXES
- * will be used. Individual entries may contain an additional order
- * element of the form [order:]suffix, e.g. 100:.sar
- *
- * The suffixes specified during init, will remain constant,
- * i.e. they can't be overriden or removed.
- */
- public void initialize()
- {
- // if enhancedSuffixes not provided, use the default
- if (enhancedSuffixes == null)
- {
- enhancedSuffixes = DEFAULT_ENHANCED_SUFFIXES;
- }
-
- // reset, just in case we are called more than once
- suffixes.clear();
- staticSuffixes.clear();
-
- // add all enhanced suffixes; mark them as static, too.
- for (int i = 0; i < enhancedSuffixes.length; i++)
- {
- EnhancedSuffix es = new EnhancedSuffix(enhancedSuffixes[i]);
- addSuffix(es);
-
- // mark all initial entries as static!
- staticSuffixes.add(es.suffix);
- }
-
- // set the resulting SuffixOrder
- sorter.setSuffixOrder(produceSuffixOrder());
- }
-
- /**
- * Add the specified enhanced suffixes in the correct
- * position(s) and regenerate the SuffixOrder, if needed.
- *
- * A suffix that exists already and is marked as static
- * will be skipped. Otherwise, duplicate entries are allowed.
- */
- public void addEnhancedSuffixes(String [] enhancedSuffixes)
- {
- if (enhancedSuffixes != null)
- {
- // remember the initial size of the list
- int size = suffixes.size();
-
- // add all enhanced suffixes
- for (int i = 0; i < enhancedSuffixes.length; i++)
- {
- EnhancedSuffix es = new EnhancedSuffix(enhancedSuffixes[i]);
- addSuffix(es);
- }
- if (suffixes.size() > size)
- {
- // suffixes were added, recreate the resulting SuffixOrder
- sorter.setSuffixOrder(produceSuffixOrder());
- }
- }
- }
-
- /**
- * Insert the specified suffixes in the correct position
- * and regenerate the SuffixOrder array, if needed.
- *
- * A suffix that exists already and is marked as static
- * will be skipped. Otherwise, duplicate entries are allowed.
- */
- public void addSuffixes(String[] suffixes, int relativeOrder)
- {
- if (suffixes != null)
- {
- // remember the initial size of the list
- int size = this.suffixes.size();
-
- for (int i = 0; i < suffixes.length; i++)
- {
- addSuffix(new EnhancedSuffix(suffixes[i], relativeOrder));
- }
-
- if (this.suffixes.size() > size)
- {
- // suffixes were added, recreate the resulting SuffixOrder
- sorter.setSuffixOrder(produceSuffixOrder());
- }
- }
- }
-
- /**
- * Remove the enhanced suffixes if they are not marked as static
- * and regenerate the SuffixOrder, if needed.
- */
- public void removeEnhancedSuffixes(String[] enhancedSuffixes)
- {
- if (enhancedSuffixes != null)
- {
- // remember the initial size of the list
- int size = suffixes.size();
-
- for (int i = 0; i < enhancedSuffixes.length; i++)
- {
- EnhancedSuffix es = new EnhancedSuffix(enhancedSuffixes[i]);
-
- // if this is a static suffix, don't remove
- if (staticSuffixes.contains(es.suffix))
- {
- continue;
- }
- else
- {
- // remove if exists
- suffixes.remove(es);
- }
- }
-
- if (this.suffixes.size() < size)
- {
- // entries removed, recreate the resulting SuffixOrder
- sorter.setSuffixOrder(produceSuffixOrder());
- }
- }
- }
-
- /**
- * Remove the specified suffixes if they are not marked as static
- * and regenerate the SuffixOrder, if needed.
- */
- public void removeSuffixes(String[] suffixes, int relativeOrder)
- {
- if (suffixes != null)
- {
- // remember the initial size of the list
- int size = this.suffixes.size();
-
- for (int i = 0; i < suffixes.length; i++)
- {
- // if this is a static suffix, don't remove
- if (staticSuffixes.contains(suffixes[i]))
- {
- continue;
- }
- else
- {
- // remove if exists
- this.suffixes.remove(new EnhancedSuffix(suffixes[i], relativeOrder));
- }
- }
-
- if (this.suffixes.size() < size)
- {
- // entries removed, recreate the resulting SuffixOrder
- sorter.setSuffixOrder(produceSuffixOrder());
- }
- }
- }
-
- // Private -------------------------------------------------------
-
- /**
- * Produce the SuffixOrder from the sorted suffixes ArrayList
- */
- private String[] produceSuffixOrder()
- {
- String[] suffixOrder = new String[suffixes.size()];
-
- for (int i = 0; i < suffixes.size(); i++)
- {
- suffixOrder[i] = ((EnhancedSuffix)suffixes.get(i)).suffix;
- }
- return suffixOrder;
- }
-
- /**
- * Add an EnhancedSuffix at the correct position in the sorted List.
- *
- * Sorting is based on EnhancedSuffix.order. A new entry with an equal
- * order value to an existing entry is placed AFTER the existing entry.
- *
- * If EnhancedSuffix.suffix exists in the staticSuffixes Set the entry
- * is NOT added. Otherwise, they EnhancedSuffix will be added, even
- * if it is a duplicate of an existing one.
- *
- * @param enhancedsuffix the enhanced suffix
- */
- private void addSuffix(EnhancedSuffix enhancedSuffix)
- {
- // if this is a static suffix, don't add it
- if (staticSuffixes.contains(enhancedSuffix.suffix))
- {
- log.debug("Static suffix exists; ignoring request for adding enhanced suffix: " + enhancedSuffix);
- }
- else
- {
- int size = suffixes.size();
-
- // if List empty, just add the suffix
- if (size == 0)
- {
- suffixes.add(enhancedSuffix);
- }
- else
- {
- // insertion sort starting from the last element
- for (int i = size - 1; i > -1; i--)
- {
- EnhancedSuffix entry = (EnhancedSuffix)suffixes.get(i);
- if (enhancedSuffix.order >= entry.order)
- {
- // add the suffix AFTER the entry and stop
- suffixes.add(i + 1, enhancedSuffix);
- break;
- }
- else if (i == 0)
- {
- // reached the beginning so add the suffix right there
- suffixes.add(0, enhancedSuffix);
- }
- }
- }
- }
- }
-
- /**
- * Inner class that encapsulates an enhanceSuffix
- * consisting of suffix + order
- */
- public final static class EnhancedSuffix
- {
- /** The suffix, e.g. .sar */
- public String suffix;
-
- /** The order, by convention a 3 digit number, e.g. 100 */
- public int order;
-
- /**
- * Simple CTOR
- */
- public EnhancedSuffix(String suffix, int order)
- {
- this.suffix = suffix;
- this.order = order;
- }
-
- /**
- * CTOR that parses an enhancedSuffix string of the form: [order:]suffix
- * If the optional 'order' is missing, use DEFAULT_RELATIVE_ORDER
- */
- public EnhancedSuffix(String enhancedSuffix) throws IllegalArgumentException
- {
- StringTokenizer tokenizer = new StringTokenizer(enhancedSuffix, ":");
- int tokens = tokenizer.countTokens();
-
- switch (tokens)
- {
- case 1:
- this.order = DEFAULT_RELATIVE_ORDER;
- this.suffix = enhancedSuffix;
- break;
-
- case 2:
- this.order = Integer.parseInt(tokenizer.nextToken());
- this.suffix = tokenizer.nextToken();
- break;
-
- default:
- throw new IllegalArgumentException("Cannot parse enhancedSuffix: " + enhancedSuffix);
- }
- }
-
- /**
- * Override equals to allow EnhancedSuffix to be searchable
- * using ArrayList.indexOf()/ArrayList.lastIndexOf()
- *
- * Base equality on both suffix and order
- */
- public boolean equals(Object other)
- {
- if (other == this)
- return true;
-
- if (!(other instanceof EnhancedSuffix))
- return false;
-
- EnhancedSuffix that = (EnhancedSuffix)other;
-
- // suffix shouldn't be null
- return this.suffix.equals(that.suffix) && this.order == that.order;
- }
-
- /**
- * Use both fields
- */
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + suffix.hashCode();
- result = 37 * result + order;
- return result;
- }
-
- /**
- * Pretty print
- */
- public String toString()
- {
- return order + ":" + suffix;
- }
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,280 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.bootstrap.spi.util.ServerConfigUtil;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.util.xml.DOMWriter;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.util.xml.JBossErrorHandler;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * XSLSubDeployer
- *
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class XSLSubDeployer extends SubDeployerSupport implements XSLSubDeployerMBean
-{
- protected String xslUrl;
-
- protected String packageSuffix;
-
- protected String ddSuffix;
-
- protected DocumentBuilderFactory dbf;
-
- private Templates templates;
-
- protected ObjectName delegateName = SARDeployerMBean.OBJECT_NAME;
-
- protected SubDeployer delegate;
-
- /** A flag indicating if deployment descriptors should be validated */
- private boolean validateDTDs;
-
- public XSLSubDeployer()
- {
-
- }
-
- public void setXslUrl(final String xslUrl)
- {
- this.xslUrl = xslUrl;
- }
-
- public String getXslUrl()
- {
- return xslUrl;
- }
-
- public void setPackageSuffix(final String packageSuffix)
- {
- this.packageSuffix = packageSuffix;
- }
-
- public String getPackageSuffix()
- {
- return packageSuffix;
- }
-
- public void setDdSuffix(final String ddSuffix)
- {
- this.ddSuffix = ddSuffix;
- }
-
- public String getDdSuffix()
- {
- return ddSuffix;
- }
-
- public void setDelegateName(final ObjectName delegateName)
- {
- this.delegateName = delegateName;
- }
-
- public ObjectName getDelegateName()
- {
- return delegateName;
- }
- public boolean getValidateDTDs()
- {
- return validateDTDs;
- }
-
- public void setValidateDTDs(boolean validate)
- {
- this.validateDTDs = validate;
- }
-
- protected void createService() throws Exception
- {
- super.createService();
- delegate = (SubDeployer) MBeanProxyExt.create(SubDeployer.class, delegateName, server);
-
- TransformerFactory tf = TransformerFactory.newInstance();
- dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- dbf.setValidating(validateDTDs);
-
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xslUrl);
- StreamSource ss = new StreamSource(is);
- templates = tf.newTemplates(ss);
- log.debug("Created templates: " + templates);
- }
-
- protected void destroyService() throws Exception
- {
- templates = null;
- super.destroyService();
- }
-
- public boolean accepts(DeploymentInfo di)
- {
- String urlStr = di.url.toString();
- return (packageSuffix != null && (urlStr.endsWith(packageSuffix) || urlStr.endsWith(packageSuffix + "/")))
- || (ddSuffix != null && urlStr.endsWith(ddSuffix));
- }
-
- public void init(DeploymentInfo di) throws DeploymentException
- {
- if (di.document == null)
- findDd(di);
-
- try
- {
- Transformer trans = templates.newTransformer();
- String urlStr = di.url.toString();
- String shortURL = ServerConfigUtil.shortUrlFromServerHome(urlStr);
- trans.setErrorListener(new JBossErrorHandler(shortURL, null));
- Source s = new DOMSource(di.document);
- DOMResult r = new DOMResult();
- setParameters(trans);
-
- trans.transform(s, r);
-
- di.document = (Document) r.getNode();
- if (log.isDebugEnabled())
- {
- log.debug("transformed into doc: " + di.document);
- String docStr = DOMWriter.printNode(di.document, true);
- int index = docStr.toLowerCase().indexOf("password");
- if (index != -1)
- {
- docStr = maskPasswords(docStr, index);
- }
- log.debug("transformed into doc: " + docStr);
- }
- }
- catch (TransformerException ce)
- {
- throw new DeploymentException("Problem with xsl transformation", ce);
- }
- delegate.init(di);
- }
-
- public void create(DeploymentInfo di) throws DeploymentException
- {
- delegate.create(di);
- }
-
- public void start(DeploymentInfo di) throws DeploymentException
- {
- delegate.start(di);
- }
-
- public void stop(DeploymentInfo di) throws DeploymentException
- {
- delegate.stop(di);
- }
-
- public void destroy(DeploymentInfo di) throws DeploymentException
- {
- delegate.destroy(di);
- }
-
- protected void setParameters(Transformer trans) throws TransformerException
- {
- //override to set document names etc.
- }
-
- protected void findDd(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- DocumentBuilder db = dbf.newDocumentBuilder();
- String urlStr = di.url.toString();
- String shortURL = ServerConfigUtil.shortUrlFromServerHome(urlStr);
- JBossEntityResolver resolver = new JBossEntityResolver();
- db.setEntityResolver(resolver);
- db.setErrorHandler(new JBossErrorHandler(shortURL, resolver));
-
- if (ddSuffix != null && urlStr.endsWith(ddSuffix))
- di.document = db.parse(di.url.openStream());
- }
- catch (SAXException se)
- {
- throw new DeploymentException("Could not parse dd", se);
- }
- catch (IOException ioe)
- {
- throw new DeploymentException("Could not read dd", ioe);
- }
- catch (ParserConfigurationException pce)
- {
- throw new DeploymentException("Could not create document builder for dd", pce);
- }
- }
-
- /**
- * Masks passwords so they are not visible in the log.
- *
- * @param original <code>String</code> plain-text passwords
- * @param index index where the password keyword was found
- * @return modified <code>String</code> with masked passwords
- */
- private String maskPasswords(String original, int index)
- {
- StringBuilder sb = new StringBuilder(original);
- String modified = null;
- int startPasswdStringIndex = sb.indexOf(">", index);
- if (startPasswdStringIndex != -1)
- {
- // checks if the keyword 'password' was not in a comment
- if (sb.charAt(startPasswdStringIndex - 1) != '-')
- {
- int endPasswdStringIndex = sb.indexOf("<", startPasswdStringIndex);
- if (endPasswdStringIndex != -1) // shouldn't happen, but check anyway
- {
- sb.replace(startPasswdStringIndex + 1, endPasswdStringIndex, "****");
- }
- }
- modified = sb.toString();
- // unlikely event of more than one password
- index = modified.toLowerCase().indexOf("password", startPasswdStringIndex);
- if (index != -1)
- return maskPasswords(modified, index);
- return modified;
- }
- return original;
- }
-}
Deleted: trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployerMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/deployment/XSLSubDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployment;
-
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * MBean interface.
- */
-public interface XSLSubDeployerMBean extends SubDeployerExtMBean
-{
- public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:service=XSLDeployer");
-
- void setXslUrl(String xslUrl);
- String getXslUrl();
-
- void setPackageSuffix(String packageSuffix);
- String getPackageSuffix();
-
- void setDdSuffix(String ddSuffix);
- String getDdSuffix();
-
- void setDelegateName(ObjectName delegateName);
- ObjectName getDelegateName();
-
- void setValidateDTDs(boolean validate);
- boolean getValidateDTDs();
-}
Modified: trunk/system-jmx/src/main/org/jboss/system/ServiceController.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/ServiceController.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/system/ServiceController.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -28,6 +28,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
+
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
import javax.management.Notification;
@@ -39,8 +40,6 @@
import org.jboss.dependency.spi.ControllerState;
import org.jboss.dependency.spi.DependencyInfo;
import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.DeploymentState;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.kernel.spi.dependency.KernelController;
@@ -209,22 +208,6 @@
return ServiceConfigurator.getConfiguration(server, this, objectNames);
}
- public void validateDeploymentState(DeploymentInfo di, DeploymentState state)
- {
- List<ObjectName> mbeans = new ArrayList<ObjectName>(di.mbeans);
- if (di.deployedObject != null)
- mbeans.add(di.deployedObject);
- boolean mbeansStateIsValid = true;
- for (ObjectName serviceName : mbeans)
- {
- ServiceContext ctx = getServiceContext(serviceName);
- if (ctx != null && state == DeploymentState.STARTED)
- mbeansStateIsValid &= ctx.state == ServiceContext.RUNNING;
- }
- if (mbeansStateIsValid == true)
- di.state = state;
- }
-
public List<ObjectName> install(List<ServiceMetaData> metaDatas, ObjectName loaderName) throws Exception
{
KernelController controller = kernel.getController();
Modified: trunk/system-jmx/src/main/org/jboss/system/ServiceControllerMBean.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/ServiceControllerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/system/ServiceControllerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -26,8 +26,6 @@
import javax.management.ObjectName;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.DeploymentState;
import org.jboss.mx.util.ObjectNameFactory;
import org.w3c.dom.Element;
@@ -76,15 +74,6 @@
String listConfiguration(ObjectName[] objectNames) throws Exception;
/**
- * Go through the mbeans of the DeploymentInfo and validate that
- * they are in a state at least equal to that of the argument state
- *
- * @param di the deployment info
- * @param state the deployment state
- */
- void validateDeploymentState(DeploymentInfo di, DeploymentState state);
-
- /**
* Deploy the beans; deploy means "instantiate and configure" so the MBean
* is created in the MBeanServer. You must call "create" and "start" separately
* on the MBean to affect the service lifecycle deploy doesn't bother with service
Modified: trunk/system-jmx/src/main/org/jboss/system/ServiceMBeanSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/ServiceMBeanSupport.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/system/ServiceMBeanSupport.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -22,7 +22,6 @@
package org.jboss.system;
import javax.management.AttributeChangeNotification;
-import javax.management.JMException;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanRegistration;
@@ -36,8 +35,6 @@
import org.jboss.beans.metadata.api.annotations.Stop;
import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.SARDeployerMBean;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
import org.jboss.logging.Logger;
@@ -161,24 +158,6 @@
return serviceName;
}
- /**
- * Provide access to the service DeploymentInfo. This is only available
- * after the service has passed its create step.
- *
- * @return The service DeploymentInfo if found registered under the SARDeployer.
- * @throws JMException - thrown on failure to invoke
- * SARDeployer.getService(ObjectName)
- */
- public DeploymentInfo getDeploymentInfo()
- throws JMException
- {
- Object[] args = {serviceName};
- String[] sig = {serviceName.getClass().getName()};
- DeploymentInfo sdi = (DeploymentInfo) server.invoke(SARDeployerMBean.OBJECT_NAME,
- "getService", args, sig);
- return sdi;
- }
-
public MBeanServer getServer()
{
return server;
Deleted: trunk/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,256 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.filterfactory;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.management.Notification;
-import javax.management.NotificationFilter;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.mx.util.JBossNotificationFilterSupport;
-import org.jboss.system.NotificationFilterFactory;
-import org.jboss.util.collection.CollectionsFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Factory for {@link DeploymentInfoNotificationFilter} filters.
- * (check the inner class).
- *
- * The produced filter is really meant for Notifications
- * emitted by SubDeployers. The types of interest are:
- *
- * org.jboss.deployment.SubDeployer.init
- * org.jboss.deployment.SubDeployer.create
- * org.jboss.deployment.SubDeployer.start
- * org.jboss.deployment.SubDeployer.stop
- * org.jboss.deployment.SubDeployer.destroy
- *
- * The above subdeployer notifications carry a DeploymentInfo
- * instance in their UserData. We can further filter based on
- * DeploymentInfo.shortName, but is important to explicitly
- * enable both the notification types and the desired shortNames.
- *
- * In practice, you'll be able to receive notifications when a
- * particular deployment unit (e.g. my-app.ear) gets processed
- * (e.g. started, stopped, etc.) by a subdeployer.
- *
- * The passed filterConfig xml element fragment should look like:
- *
- * <filter factory="DeploymentInfoNotificationFilterFactory">
- * <enable type="org.jboss.deployment.SubDeployer.start"/>
- * <enable type="org.jboss.deployment.SubDeployer.stop"/>
- * ...
- * <enable short-name="my-app.ear"/>
- * <enable short-name="my-service.xml"/>
- * ...
- * </filter>
- *
- * Note: org.jboss.deployment.SubDeployer yields all five
- * SubDeployer notifications.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- * @since 4.0.3
-**/
-public class DeploymentInfoNotificationFilterFactory
- implements NotificationFilterFactory
-{
- // Constants -----------------------------------------------------
-
- /** the xml element and attribute supported by this factory */
- public static final String ENABLE_ELEMENT = "enable";
- public static final String ENABLE_TYPE_ATTRIBUTE = "type";
- public static final String ENABLE_SHORTNAME_ATTRIBUTE = "short-name";
-
- /**
- * Default public CTOR (necessary)
- */
- public DeploymentInfoNotificationFilterFactory()
- {
- // empty
- }
-
- /**
- * The actual filter factory implementation
- */
- public NotificationFilter createNotificationFilter(Element filterConfig)
- throws Exception
- {
- // start off with a filter that does not allow any type
- DeploymentInfoNotificationFilter filter = new DeploymentInfoNotificationFilter();
-
- // filterConfig should point to the <filter factory="..."> element,
- // we are interested in its 'enable' children to configure the filter
- NodeList filterChildren = filterConfig.getChildNodes();
-
- for (int i = 0; i < filterChildren.getLength(); i++)
- {
- Node filterChildNode = filterChildren.item(i);
-
- // check if this is an 'enable' element, ignore everything else
- if (filterChildNode.getNodeName().equals(ENABLE_ELEMENT))
- {
- // look for 'type' attribute
- if (((Element)filterChildNode).hasAttribute(ENABLE_TYPE_ATTRIBUTE))
- {
- String type = ((Element)filterChildNode).getAttribute(ENABLE_TYPE_ATTRIBUTE);
- // enable this type in the filter
- filter.enableType(type);
- }
- else if (((Element)filterChildNode).hasAttribute(ENABLE_SHORTNAME_ATTRIBUTE))
- {
- String shortName = ((Element)filterChildNode).getAttribute(ENABLE_SHORTNAME_ATTRIBUTE);
- // enable this shortName in the filter
- filter.enableShortName(shortName);
- }
- else
- {
- throw new Exception("'" + ENABLE_ELEMENT + "' element must have a '"
- + ENABLE_TYPE_ATTRIBUTE + "' or a '" + ENABLE_SHORTNAME_ATTRIBUTE + "' attribute");
- }
- }
- }
- // we are done
- return filter;
- }
-
- /**
- * A NotificationFilter that can filter Notifications that
- * carry a DeploymentInfo payload in the UserData field.
- *
- * The Notification is filtered first on its type,
- * then on its DeploymentInfo.shortName.
- *
- * Uses copy-on-write semantics for fast unsynchronized access.
- */
- public static class DeploymentInfoNotificationFilter extends JBossNotificationFilterSupport
- {
- private static final long serialVersionUID = -5067618040005609685L;
-
- /** The short names that will pass the filter */
- private Set enabledShortNames;
-
- // Constructors -----------------------------------------------
-
- /**
- * Default CTOR.
- *
- * Create a filter that filters out all notification types/sortnames.
- */
- public DeploymentInfoNotificationFilter()
- {
- super();
- enabledShortNames = CollectionsFactory.createCopyOnWriteSet();
- }
-
- /**
- * Disable all shortNames. Rejects all notifications.
- */
- public void disableAllShortNames()
- {
- enabledShortNames.clear();
- }
-
- /**
- * Disable a shortName.
- *
- * @param name the shortName to disable.
- */
- public void disableShortName(String name)
- {
- enabledShortNames.remove(name);
- }
-
- /**
- * Enable a shortName.
- *
- * @param name the shortName to enable.
- * @exception IllegalArgumentException for a null name.
- */
- public void enableShortName(String name) throws IllegalArgumentException
- {
- if (name == null)
- {
- throw new IllegalArgumentException("null shortName");
- }
- enabledShortNames.add(name);
- }
-
- /**
- * Get all the enabled short names.<p>
- *
- * Returns a vector of enabled short names.<br>
- * An empty vector means all short names disabled.
- *
- * @return the vector of enabled short names.
- */
- public Vector getEnabledShortNames()
- {
- return new Vector(enabledShortNames);
- }
-
- /**
- * @return human readable string.
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer(100);
-
- sb.append(getClass().getName()).append(':');
- sb.append(" enabledTypes=").append(getEnabledTypes());
- sb.append(" enabledShortNames=").append(getEnabledShortNames());
-
- return sb.toString();
- }
-
- // NotificationFilter implementation ---------------------------
-
- /**
- * Test to see whether this notification is enabled
- *
- * @param notification the notification to filter
- * @return true when the notification should be sent, false otherwise
- * @exception IllegalArgumentException for null notification.
- */
- public boolean isNotificationEnabled(Notification notification)
- {
- // check if the notification type is not enabled in the super class
- if (super.isNotificationEnabled(notification) == false)
- {
- return false;
- }
-
- // Check the shortName in the payload. We assume that proper
- // filtering on notification type, ensures that the
- // notification actually carries a DeploymentInfo.
- DeploymentInfo di = (DeploymentInfo)notification.getUserData();
- String shortName = di.shortName;
-
- // Return true if the shortName is enabled, false otherwise
- return enabledShortNames.contains(shortName);
- }
- }
-}
Modified: trunk/system-jmx/src/tests/org/jboss/test/system/controller/legacy/OldServiceController.java
===================================================================
--- trunk/system-jmx/src/tests/org/jboss/test/system/controller/legacy/OldServiceController.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/system-jmx/src/tests/org/jboss/test/system/controller/legacy/OldServiceController.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -43,8 +43,6 @@
import javax.management.ObjectName;
import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.DeploymentState;
import org.jboss.logging.Logger;
import org.jboss.mx.server.ServerConstants;
import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
@@ -137,23 +135,6 @@
return configurator.getConfiguration(objectNames);
}
- public void validateDeploymentState(DeploymentInfo di, DeploymentState state)
- {
- ArrayList<ObjectName> mbeans = new ArrayList<ObjectName>(di.mbeans);
- if (di.deployedObject != null)
- mbeans.add(di.deployedObject);
- boolean mbeansStateIsValid = true;
- for (int m = 0; m < mbeans.size(); m++)
- {
- ObjectName serviceName = mbeans.get(m);
- ServiceContext ctx = this.getServiceContext(serviceName);
- if (ctx != null && state == DeploymentState.STARTED)
- mbeansStateIsValid &= ctx.state == ServiceContext.RUNNING;
- }
- if (mbeansStateIsValid == true)
- di.state = state;
- }
-
public synchronized List<ObjectName> install(Element config, ObjectName loaderName) throws DeploymentException
{
List<ObjectName> mbeans = configurator.install(config, loaderName);
Deleted: trunk/testsuite/src/main/org/jboss/test/jmx/test/AbstractURLDeploymentScannerTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jmx/test/AbstractURLDeploymentScannerTest.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/testsuite/src/main/org/jboss/test/jmx/test/AbstractURLDeploymentScannerTest.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,219 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jmx.test;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.test.JBossTestCase;
-import org.jboss.test.JBossTestSetup;
-import org.jboss.util.file.Files;
-import org.jboss.util.file.JarUtils;
-import org.jboss.util.stream.Streams;
-
-/**
- * Base test for url deployment scanner
- *
- * @author adrian at jboss.org
- * @author dimitris at jboss.org
- * @version $Revision$
- */
-public abstract class AbstractURLDeploymentScannerTest extends JBossTestCase
-{
- protected static ObjectName scanner = ObjectNameFactory.create("jboss.test:type=DeploymentScanner,flavor=URL");
-
- private static URL scanDir;
-
- public AbstractURLDeploymentScannerTest(String name)
- {
- super(name);
- }
-
- public static Test getTestSuite(Class clazz) throws Exception
- {
- TestSuite suite = new TestSuite();
- suite.addTest(new TestSuite(clazz));
- JBossTestSetup setup = new JBossTestSetup(suite)
- {
- protected void setUp() throws Exception
- {
- super.setUp();
- MBeanServerConnection server = getServer();
- scanDir = getScanURL();
- getLog().debug("Scan Directory=" + scanDir);
- server.invoke(scanner, "addURL", new Object[] { scanDir }, new String[] { URL.class.getName() });
- }
- };
- return getDeploySetup(setup, "jbosstest-urlscanner-service.xml");
- }
-
- public void startScanner() throws Exception
- {
- getServer().invoke(scanner, "start", null, null);
- }
-
- public void stopScanner() throws Exception
- {
- getServer().invoke(scanner, "stop", null, null);
- }
-
- /**
- * The deployment URL of a filename, inside the scan directory
- */
- public URL getTargetURL(String fileName) throws Exception
- {
- return new URL(scanDir, fileName);
- }
-
- /**
- * Delegate to Scanner
- */
- public void suspendDeployment(URL url) throws Exception
- {
- getServer().invoke(
- scanner,
- "suspendDeployment",
- new Object[] { url },
- new String[] { URL.class.getName() });
- }
-
- /**
- * Delegate to Scanner
- */
- public void resumeDeployment(URL url, boolean markUpToDate) throws Exception
- {
- getServer().invoke(
- scanner,
- "resumeDeployment",
- new Object[] { url, new Boolean(markUpToDate) },
- new String[] { URL.class.getName(), boolean.class.getName() });
- }
-
- public void hotDeploy(String fileName) throws Exception
- {
- hotDeploy(fileName, 2000);
- }
-
- public void hotDeploy(String fileName, long wait) throws Exception
- {
- URL url = getDeployURL(fileName);
- URL destURL = getTargetURL(fileName);
- copy(url, new File(destURL.getFile()));
- // TODO something better than a sleep
- if (wait > 0)
- Thread.sleep(wait);
- }
-
- public void hotUndeploy(String fileName) throws Exception
- {
- hotUndeploy(fileName, 2000);
- }
-
- public void hotUndeploy(String fileName, long wait) throws Exception
- {
- URL destURL = new URL(scanDir, fileName);
- delete(new File(destURL.getFile()));
- // TODO something better than a sleep
- if (wait > 0)
- Thread.sleep(wait);
- }
-
- protected void copy(URL src, File dest) throws IOException
- {
- log.debug("Copying " + src + " -> " + dest);
-
- // Validate that the dest parent directory structure exists
- File dir = dest.getParentFile();
- if (!dir.exists())
- {
- boolean created = dir.mkdirs();
- if( created == false )
- throw new IOException("mkdirs failed for: "+dir.getAbsolutePath());
- }
-
- // Remove any existing dest content
- if( dest.exists() == true )
- {
- boolean deleted = Files.delete(dest);
- if( deleted == false )
- throw new IOException("delete of previous content failed for: "+dest.getAbsolutePath());
- }
-
- if (src.getProtocol().equals("file"))
- {
- File srcFile = new File(src.getFile());
- if (srcFile.isDirectory())
- {
- log.debug("Making zip copy of: " + srcFile);
- // make a jar archive of the directory
- OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
- JarUtils.jar(out, srcFile.listFiles());
- out.close();
- return;
- }
- }
-
- InputStream in = new BufferedInputStream(src.openStream());
- OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
- Streams.copy(in, out);
- out.flush();
- out.close();
- in.close();
- }
-
- protected void delete(File dest) throws IOException
- {
- log.debug("Deleting " + dest);
-
- // Remove any existing dest content
- if( dest.exists() == true )
- {
- boolean deleted = Files.delete(dest);
- if( deleted == false )
- throw new IOException("delete of previous content failed for: "+dest.getAbsolutePath());
- }
- }
-
- private static URL getScanURL() throws Exception
- {
- String deployDir = System.getProperty("jbosstest.deploy.dir");
- if (deployDir == null)
- deployDir = "../lib";
- File file = new File(deployDir);
- File scanDir = new File(file, "urlscannertest");
- URL url = scanDir.toURL();
- return url;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/jmx/test/JBAS3050URLDeploymentScannerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jmx/test/JBAS3050URLDeploymentScannerUnitTestCase.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/testsuite/src/main/org/jboss/test/jmx/test/JBAS3050URLDeploymentScannerUnitTestCase.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jmx.test;
-
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.system.ServiceMBean;
-
-import junit.framework.Test;
-
-/**
- * JBAS3050URLDeploymentScannerUnitTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class JBAS3050URLDeploymentScannerUnitTestCase extends AbstractURLDeploymentScannerTest
-{
- ObjectName test = ObjectNameFactory.create("test:name=PauseInStart");
-
- protected class DeployInBackground implements Runnable
- {
- Throwable background;
-
- String fileName;
-
- public DeployInBackground(String fileName)
- {
- this.fileName = fileName;
- }
-
- public void run()
- {
- try
- {
- hotDeploy(fileName, 2000);
- }
- catch (Throwable t)
- {
- background = t;
- }
- }
- }
-
- public void testDeadlock() throws Exception
- {
- DeployInBackground background = new DeployInBackground("pauseinstart.sar");
- Thread thread = new Thread(background);
- thread.start();
- try
- {
- Thread.sleep(4000);
- stopScanner();
- assertEquals(new Integer(ServiceMBean.STARTED), getServer().getAttribute(test, "State"));
- hotDeploy("pauseinstart.sar");
- startScanner();
- assertEquals(new Integer(ServiceMBean.STARTED), getServer().getAttribute(test, "State"));
- }
- finally
- {
- thread.join();
- hotUndeploy("pauseinstart.sar");
- }
- }
-
- public static Test suite() throws Exception
- {
- return getTestSuite(JBAS3050URLDeploymentScannerUnitTestCase.class);
- }
-
- public JBAS3050URLDeploymentScannerUnitTestCase(String name)
- {
- super(name);
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/jmx/test/SimpleURLDeploymentScannerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jmx/test/SimpleURLDeploymentScannerUnitTestCase.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/testsuite/src/main/org/jboss/test/jmx/test/SimpleURLDeploymentScannerUnitTestCase.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jmx.test;
-
-import java.net.URL;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.system.ServiceMBean;
-
-/**
- * SimpleURLDeploymentScannerUnitTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public class SimpleURLDeploymentScannerUnitTestCase extends AbstractURLDeploymentScannerTest
-{
- ObjectName test = ObjectNameFactory.create("test:name=DefaultPkgService");
- String module = "defaultpkg.sar";
-
- public void testSomething() throws Exception
- {
- hotDeploy(module);
- try
- {
- assertEquals(new Integer(ServiceMBean.STARTED), getServer().getAttribute(test, "State"));
- }
- finally
- {
- hotUndeploy(module);
- }
- assertFalse(getServer().isRegistered(test));
- }
-
- /**
- * Test JBAS-3118 feature
- */
- public void testSuspendResumeDeployment() throws Exception
- {
- // tell the scanner to ignore the deployment
- URL deployment = getTargetURL(module);
- suspendDeployment(deployment);
-
- try
- {
- // now deploy, but expect that nothing happens at this point
- hotDeploy(module);
- assertFalse(getServer().isRegistered(test));
-
- // tell the scanner to resume the deployment,
- // wait and see if it was actually deployed
- resumeDeployment(deployment, false);
- super.sleep(2000);
- assertEquals(new Integer(ServiceMBean.STARTED), getServer().getAttribute(test, "State"));
-
- // suspend again and undeploy, the module shouldn't be undeployed
- suspendDeployment(deployment);
- hotUndeploy(module);
- assertEquals(new Integer(ServiceMBean.STARTED), getServer().getAttribute(test, "State"));
-
- // tell the scanner to resume the deployment,
- // wait and see if it was actually undeployed
- resumeDeployment(deployment, false);
- super.sleep(2000);
- assertFalse(getServer().isRegistered(test));
- }
- catch (Exception ignore)
- {
- hotUndeploy(module);
- }
- }
-
- public static Test suite() throws Exception
- {
- return getTestSuite(SimpleURLDeploymentScannerUnitTestCase.class);
- }
-
- public SimpleURLDeploymentScannerUnitTestCase(String name)
- {
- super(name);
- }
-}
Modified: trunk/varia/src/main/org/jboss/services/deployment/DeploymentManager.java
===================================================================
--- trunk/varia/src/main/org/jboss/services/deployment/DeploymentManager.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/services/deployment/DeploymentManager.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -49,8 +49,6 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.logging.Logger;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.services.deployment.metadata.ConfigInfo;
@@ -407,33 +405,7 @@
*/
public String configPathFor(String name) throws Exception
{
- if (log.isDebugEnabled()) log.debug("configPathFor(" + name + ")");
- String result = null;
-
- // Get the collection of mbean deployment info objects:
- Collection deploymentColl = (Collection) MBeanServerLocator.locateJBoss().invoke(
- new ObjectName(MAIN_DEPLOYER_OBJECT_NAME), MAIN_DEPLOYER_LIST_OPERATION_NAME, null, null);
-
- // Iterate through that collection, looking for the one that contains an
- // mbean whose name matches the name (or pattern) provided:
- ObjectName pattern = new ObjectName(name);
- outer: for (Iterator iter = deploymentColl.iterator(); iter.hasNext();)
- {
- DeploymentInfo deploymentInfo = (DeploymentInfo) iter.next();
- List associatedMBeanObjectNames = deploymentInfo.mbeans;
- for (Iterator iterator = associatedMBeanObjectNames.iterator(); iterator.hasNext();)
- {
- ObjectName beanName = (ObjectName) iterator.next();
- if (log.isDebugEnabled()) log.debug("beanName=" + beanName);
- if (pattern.apply(beanName)) {
- result = deploymentInfo.watch.getFile();
- break outer;
- }
- }
- }
-
- if (log.isDebugEnabled()) log.debug("configPathFor()=" + result);
- return result;
+ throw new UnsupportedOperationException();
}
public void moveToDeployDir(String module)
Modified: trunk/varia/src/main/org/jboss/varia/deployment/BeanShellScript.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/BeanShellScript.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/BeanShellScript.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -21,15 +21,15 @@
*/
package org.jboss.varia.deployment;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
-import java.net.URL;
import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
@@ -43,7 +43,6 @@
import javax.management.ReflectionException;
import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.system.ServiceDynamicMBeanSupport;
import org.jboss.util.Classes;
@@ -62,7 +61,6 @@
public class BeanShellScript extends ServiceDynamicMBeanSupport
{
- protected DeploymentInfo deploymentInfo = null;
protected String name = null;
protected ScriptService scriptService = null;
@@ -77,14 +75,6 @@
// Constructors --------------------------------------------------
- @Deprecated
- public BeanShellScript(final DeploymentInfo di)
- throws DeploymentException
- {
- this.deploymentInfo = di;
- init(deploymentInfo.url);
- }
-
public BeanShellScript(final URL url)
throws DeploymentException
{
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployer.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,289 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Arrays;
-
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.SubDeployerSupport;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.ObjectNameConverter;
-import org.jboss.system.ServiceControllerMBean;
-
-/**
- * A deployer that takes a bean shell script file and creates a JBoss
- * MBean service wrapper for the script.
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>.
- * @version $Revision$
- *
- * @jmx.mbean name="jboss.system:service=BeanShellSubDeployer"
- * extends="org.jboss.deployment.SubDeployerMBean"
- */
- at Deprecated
-public class BeanShellSubDeployer extends SubDeployerSupport
- implements BeanShellSubDeployerMBean
-{
- // Constants -----------------------------------------------------
-
- //public static final String BEANSHELL_EXTENSION = ".bsh";
- public static final String BASE_SCRIPT_OBJECT_NAME = "jboss.scripts:type=BeanShell";
-
- /** The suffixes we accept, along with their relative order */
- private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] {
- "800:.bsh"
- };
-
- // Attributes ----------------------------------------------------
-
- protected ServiceControllerMBean serviceController;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- /**
- * Default contructor used to set default values to the Suffixes and RelativeOrder
- * attributes. Those are read at subdeployer registration time by the MainDeployer
- * to alter its SuffixOrder.
- */
- public BeanShellSubDeployer()
- {
- setEnhancedSuffixes(DEFAULT_ENHANCED_SUFFIXES);
- }
-
- // Public --------------------------------------------------------
-
- // Z implementation ----------------------------------------------
-
- // ServiceMBeanSupport overrides ---------------------------------------------------
-
- /**
- * Get a reference to the ServiceController
- */
- protected void startService() throws Exception
- {
- serviceController = (ServiceControllerMBean)
- MBeanProxyExt.create(ServiceControllerMBean.class,
- ServiceControllerMBean.OBJECT_NAME, server);
-
- // register with MainDeployer
- super.startService();
- }
-
- // SubDeployerSupport overrides ---------------------------------------------------
-
- protected void processNestedDeployments(DeploymentInfo di) throws DeploymentException
- {
- // no sub-deployment!
- }
-
- /**
- * Returns true if this deployer can deploy the given DeploymentInfo.
- *
- * @return True if this deployer can deploy the given DeploymentInfo.
- *
- * @jmx:managed-operation
- */
- public boolean accepts(DeploymentInfo sdi)
- {
- return super.accepts(sdi);
- }
-
- /**
- * Describe <code>init</code> method here.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx:managed-operation
- */
- public void init(DeploymentInfo di)
- throws DeploymentException
- {
- super.init(di);
- di.watch = di.url;
- }
-
- /**
- * Describe <code>create</code> method here.
- *
- * @param di a <code>DeploymentInfo</code> value
- * @exception DeploymentException if an error occurs
- * @jmx:managed-operation
- */
- public void create(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- // install the MBeans in this descriptor
- log.debug("Deploying BeanShell script, create step: url " + di.url);
-
- String lURL = di.url.toString();
- int lIndex = lURL.lastIndexOf( "/" );
- di.shortName = lURL.substring( lIndex >= 0 ? lIndex + 1 : 0 );
-
- BeanShellScript script = new BeanShellScript (di);
- ObjectName bshScriptName = script.getPreferedObjectName();
- ObjectName[] depends = script.getDependsServices();
-
- if (bshScriptName == null)
- {
- bshScriptName = ObjectNameConverter.convert(
- BASE_SCRIPT_OBJECT_NAME + ",url=" + di.url);
- }
-
- di.deployedObject = bshScriptName;
- try
- {
- server.unregisterMBean(bshScriptName);
- } catch(Exception e) { log.info(e);}
- server.registerMBean(script, bshScriptName);
-
- log.debug( "Deploying: " + di.url );
-
- // Init application
- if (depends == null)
- serviceController.create(bshScriptName);
- else
- serviceController.create(bshScriptName, Arrays.asList(depends));
- super.create(di);
- }
- catch (Exception e)
- {
- destroy(di);
- DeploymentException de = new DeploymentException("create operation failed for script "
- + di.url, e);
- throw de;
- }
- }
-
- public synchronized void start(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- // Start application
- log.debug( "start script, deploymentInfo: " + di +
- ", short name: " + di.shortName +
- ", parent short name: " +
- (di.parent == null ? "no parent" : di.parent.shortName) );
-
- serviceController.start(di.deployedObject);
-
- log.debug( "Deployed: " + di.url );
- super.start(di);
- }
- catch (Exception e)
- {
- throw new DeploymentException( "Could not deploy " + di.url, e );
- }
- }
-
- public void stop(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- serviceController.stop(di.deployedObject);
- super.stop(di);
- }
- catch (Exception e)
- {
- throw new DeploymentException( "problem stopping ejb module: " +
- di.url, e );
- }
- }
-
- public void destroy(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- serviceController.destroy( di.deployedObject );
- serviceController.remove( di.deployedObject );
- super.destroy(di);
- }
- catch (Exception e)
- {
- throw new DeploymentException( "problem destroying BSH Script: " +
- di.url, e );
- }
- }
-
- /** Create a bsh deployment given the script content and name. This creates
- * a temp file using File.createTempFile(scriptName, ".bsh") and then
- * deploys this script via the main deployer.
- *
- * @param bshScript the bsh script content
- * @param scriptName the bsh script name to use
- * @return the URL of the temporary file used as the deployment script
- *
- * @throws DeploymentException thrown on failure to create the bsh
- * script or deploy it.
- *
- * @jmx:managed-operation
- */
- public URL createScriptDeployment(String bshScript, String scriptName)
- throws DeploymentException
- {
- try
- {
- File scriptFile = File.createTempFile(scriptName, ".bsh");
- FileWriter fw = new FileWriter(scriptFile);
- try
- {
- fw.write(bshScript);
- }
- finally
- {
- fw.close();
- }
-
- URL scriptURL = scriptFile.toURL();
- mainDeployer.deploy(scriptURL);
- return scriptURL;
- }
- catch(IOException e)
- {
- throw new DeploymentException("Failed to deploy: "+scriptName, e);
- }
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployerMBean.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/BeanShellSubDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment;
-
-import java.net.URL;
-
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.SubDeployerExtMBean;
-import org.jboss.mx.util.ObjectNameFactory;
-
-/**
- * MBean interface.
- */
-public interface BeanShellSubDeployerMBean extends SubDeployerExtMBean
-{
- /** The default ObjectName */
- public static final ObjectName OBJECT_NAME =
- ObjectNameFactory.create("jboss.system:service=BeanShellSubDeployer");
-
- /**
- * Create a bsh deployment given the script content and name.
- * This creates a temp file using File.createTempFile(scriptName, ".bsh")
- * and then deploys this script via the main deployer.
- *
- * @param bshScript the bsh script content
- * @param scriptName the bsh script name to use
- * @return the URL of the temporary file used as the deployment script
- * @throws DeploymentException thrown on failure to create the bsh script or deploy it.
- */
- URL createScriptDeployment(String bshScript, String scriptName) throws DeploymentException;
-
-}
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployer.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployer.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployer.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,491 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.jar.JarFile;
-import java.util.jar.JarEntry;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.deployment.SubDeployer;
-import org.jboss.deployment.SubDeployerSupport;
-
-import org.jboss.system.ServiceControllerMBean;
-import org.jboss.system.server.ServerConfigLocator;
-
-import org.jboss.util.Counter;
-import org.jboss.util.file.Files;
-import org.jboss.util.file.JarUtils;
-import org.jboss.mx.util.MBeanProxyExt;
-
-import org.jboss.varia.deployment.convertor.Convertor;
-
-/**
- * This is the deployer for other vendor's applications
- * with dynamic migration of vendor-specific DDs to
- * JBoss specific DDs.
- *
- * @see org.jboss.varia.deployment.convertor.Convertor
- *
- * @author <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @version $Revision$
- *
- * @jmx.mbean
- * name="jboss.system:service=ServiceDeployer"
- * extends="org.jboss.deployment.SubDeployerMBean"
- */
-public class FoeDeployer
- extends SubDeployerSupport
- implements SubDeployer, FoeDeployerMBean
-{
- // Attributes ----------------------------------------------------
- /** A proxy to the ServiceControllerDeployer. */
- private ServiceControllerMBean serviceController;
-
- /** The deployers scratch directory. */
- private File scratchDirectory;
-
- /** Contains the list of available converters */
- private List converterList = new ArrayList();
-
- /** an increment for tmp files */
- private final Counter id = Counter.makeSynchronized(new Counter(0));
-
- /** map of exploaded deployment destionation in scratch directoy by DeploymentInfo */
- private ThreadLocal destinationByDI = new ThreadLocal() {
- protected Object initialValue()
- {
- return new HashMap();
- }
- };
-
- // SubDeployerSupport overrides ----------------------------------
- /**
- * Returns true if the there is a converter available to convert
- * the deployment unit.
- *
- * @jmx.managed-operation
- */
- public boolean accepts(DeploymentInfo di)
- {
- // delegate accepts to convertors
- Iterator i = converterList.iterator();
- while(i.hasNext())
- {
- Convertor converter = (Convertor)i.next();
- if(converter.accepts(di.url))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns true if the there is a converter available to convert
- * the deployment unit.
- */
- public boolean accepts(URL url)
- {
- // delegate accepts to convertors
- Iterator i = converterList.iterator();
- while(i.hasNext())
- {
- Convertor converter = (Convertor)i.next();
- if(converter.accepts(url))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * At the init phase the deployment unit and its subdeployment units are unpacked.
- * @jmx.managed-operation
- */
- public void init(DeploymentInfo di)
- throws DeploymentException
- {
- // Determine the destination for unpacking and save it in the ThreadLocal
- Map destinations = (Map)destinationByDI.get();
- File destination = (File)destinations.get(di.parent);
- if(destination == null)
- {
- // Loop until for new destination
- while(destination == null || destination.exists())
- destination = new File(scratchDirectory, id.increment() + "." + di.shortName);
- }
- else
- {
- destination = new File(destination, di.shortName);
- }
- destinations.put(di, destination);
- destinationByDI.set(destinations);
-
- try
- {
- log.debug("unpacking to " + destination);
- inflateJar(di.localUrl, destination);
- }
- catch(Exception e)
- {
- throw new DeploymentException("Unpacking failed: ", e);
- }
-
- // invoke super class' initialization
- super.init(di);
- }
-
- /**
- * At the create phase, the conversion and packing is done.
- * @jmx.managed-operation
- */
- public void create(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- // fetch the destionation of unpacked deployment from ThreadLocal
- Map destinations = (Map)destinationByDI.get();
- File inflateDest = (File)destinations.get(di);
-
- // Look for the converter that accepts vendor specific deployment descriptors
- // and let it convert them
- Iterator i = converterList.iterator();
- while(i.hasNext())
- {
- Convertor converter = (Convertor)i.next();
- if(converter.accepts(di.url))
- {
- // Convert them to JBoss specific DDs
- converter.convert(di, inflateDest);
- // Now conversion is done and we can leave
- break;
- }
- }
-
- // deflate
- File deflateDest = (File)destinations.get(di.parent);
- if(deflateDest == null)
- deflateDest = scratchDirectory;
- String validName = null;
- if(di.shortName.endsWith(".wl"))
- validName = di.shortName.substring(0, di.shortName.length()-3);
- else
- validName = di.shortName.substring( 0, di.shortName.length() - 4 ) + "jar";
- File convertedUnit = new File(deflateDest, validName);
- log.debug("deflating to " + convertedUnit);
- deflateJar(convertedUnit, inflateDest);
-
- // remove unpacked deployment unit
- Files.delete(inflateDest);
-
- // copy the converted app back to the deployment directory
- if(di.parent == null)
- copyFile(convertedUnit, new File(di.url.getFile()).getParentFile());
- }
- catch(Exception e)
- {
- log.error("Conversion error: ", e);
- }
- }
-
- /**
- * This method stops this deployment because it is not of any
- * use anymore (conversion is done)
- * @jmx.managed-operation
- */
- public void start(DeploymentInfo di)
- throws DeploymentException
- {
- stop(di);
- destroy(di);
- }
-
- /**
- * @jmx.managed-operation
- */
- public void stop(DeploymentInfo di)
- {
- log.debug("undeploying application: " + di.url);
- }
-
- /**
- * @jmx.managed-operation
- */
- public void destroy(DeploymentInfo di)
- {
- List services = di.mbeans;
- int lastService = services.size();
- for(ListIterator i = services.listIterator(lastService); i.hasPrevious();)
- {
- ObjectName name = (ObjectName)i.previous();
- log.debug( "destroying mbean " + name );
- try
- {
- serviceController.destroy(name);
- }
- catch(Exception e)
- {
- log.error("Could not destroy mbean: " + name, e);
- }
- }
-
- for(ListIterator i = services.listIterator(lastService); i.hasPrevious();)
- {
- ObjectName name = (ObjectName)i.previous();
- log.debug("removing mbean " + name);
- try
- {
- serviceController.remove( name );
- }
- catch(Exception e)
- {
- log.error("Could not remove mbean: " + name, e);
- }
- }
- }
-
- /**
- * This method is called in SubDeployerSupport.processNestedDeployments()
- * The method is overriden to deploy the deployments acceptable by FoeDeployer only.
- */
- protected void addDeployableJar(DeploymentInfo di, JarFile jarFile)
- throws DeploymentException
- {
- String urlPrefix = "jar:" + di.localUrl.toString() + "!/";
- for(Enumeration e = jarFile.entries(); e.hasMoreElements();)
- {
- JarEntry entry = (JarEntry)e.nextElement();
- String name = entry.getName();
- try
- {
- URL url = new URL(urlPrefix + name);
- if(isDeployable(name, url))
- {
- // Obtain a jar url for the nested jar
- // Append the ".wl" suffix to prevent other than FoeDeployer deployers'
- // attempts to deploy the deployment unit
- URL nestedURL = JarUtils.extractNestedJar(url, this.tempDeployDir);
- File file = new File(nestedURL.getFile());
- File wlFile = new File(nestedURL.getFile() + ".wl");
- file.renameTo(wlFile);
-
- if(accepts(wlFile.toURL()))
- {
- deployUrl(di, wlFile.toURL(), name + ".wl");
- }
- else
- {
- // if the deployment isn't accepted rename it back
- wlFile.renameTo(new File(nestedURL.getFile()));
- }
- }
- }
- catch(MalformedURLException mue)
- {
- log.warn("Jar entry invalid; ignoring: " + name, mue);
- }
- catch(IOException ex)
- {
- log.warn("Failed to extract nested jar; ignoring: " + name, ex);
- }
- }
- }
-
- /**
- * The startService method
- * - gets the mbeanProxies for MainDeployer and ServiceController;
- * - creates scratch directory for foe work.
- *
- * @exception Exception if an error occurs
- */
- protected void startService()
- throws Exception
- {
- mainDeployer = (MainDeployerMBean) MBeanProxyExt.create(
- MainDeployerMBean.class,
- MainDeployerMBean.OBJECT_NAME,
- server
- );
-
- // get the controller proxy
- serviceController = (ServiceControllerMBean) MBeanProxyExt.create(
- ServiceControllerMBean.class,
- ServiceControllerMBean.OBJECT_NAME,
- server
- );
-
- ServerConfig config = ServerConfigLocator.locate();
-
- // build the scratch directory
- File tempDirectory = config.getServerTempDir();
- scratchDirectory = new File(tempDirectory, "foe");
- if(!scratchDirectory.exists())
- scratchDirectory.mkdirs();
-
- // Note: this should go the last.
- // scratch directory must be created before this call
- super.startService();
- }
-
- /**
- * Returns the ObjectName
- */
- protected ObjectName getObjectName(MBeanServer server, ObjectName name)
- throws MalformedObjectNameException
- {
- return name == null ? OBJECT_NAME : name;
- }
-
- // FoeDeployerMBean implementation -------------------------------
- /**
- * Add a new conveter to the list. If the same converter is
- * added, this new one won't be added, meaning everything stays the same.
- * This method is normally called by a Converter to be
- * called by this deployer to convert.
- *
- * @param converter New Converter to be added
- *
- * @jmx.managed-operation
- */
- public void addConvertor(Convertor converter)
- {
- converterList.add(converter);
-
- // try to deploy waiting deployment units
- // note: there is no need to synchronize, because MainDeployer
- // returns a copy of waiting deployments
- Collection waitingDeployments = mainDeployer.listWaitingForDeployer();
- if((waitingDeployments != null) && (waitingDeployments.size() > 0))
- {
- for( Iterator iter = waitingDeployments.iterator(); iter.hasNext(); )
- {
- DeploymentInfo di = (DeploymentInfo)iter.next();
-
- // check whether the converter accepts the deployment
- if(!converter.accepts(di.url))
- continue;
-
- log.debug("trying to deploy with new converter: " + di.shortName);
- try
- {
- mainDeployer.redeploy(di);
- }
- catch (DeploymentException e)
- {
- log.error("DeploymentException while trying to deploy a package with new converter", e);
- }
- }
- }
- }
-
- /**
- * Removes a conveter from the list of converters. If the
- * converter does not exist nothing happens.
- * This method is normally called by a Converter to be removed
- * from the list if not serving anymore.
- *
- * @param converter Conveter to be removed from the list
- *
- * @jmx.managed-operation
- */
- public void removeConvertor(Convertor converter)
- {
- converterList.remove(converter);
- }
-
- // Private --------------------------------------------------------
- /**
- * The <code>inflateJar</code> copies the jar entries
- * from the jar url jarUrl to the directory destDir.
- *
- * @param fileURL URL pointing to the file to be inflated
- * @param destinationDirectory Directory to which the content shall be inflated to
- *
- * @exception DeploymentException if an error occurs
- * @exception IOException if an error occurs
- */
- protected void inflateJar( URL fileURL, File destinationDirectory )
- throws DeploymentException, IOException
- {
- File destFile = new File(fileURL.getFile());
- InputStream input = new FileInputStream(fileURL.getFile());
- JarUtils.unjar(input, destinationDirectory);
- // input is closed in unjar();
- }
-
- /**
- * Deflate a given directory into a JAR file
- *
- * @param jarFile The JAR file to be created
- * @param root Root directory of the files to be included (this directory
- * will not be included in the path of the JAR content)
- **/
- private void deflateJar( File jarFile, File root )
- throws Exception
- {
- OutputStream output = new FileOutputStream(jarFile);
- JarUtils.jar(output, root.listFiles(), null, null, null);
- output.close();
- }
-
- /**
- * Copies the given File to a new destination with the same name
- *
- * @param source The source file to be copied
- * @param destinationDirectory File pointing to the destination directory
- **/
- private void copyFile(File source, File destinationDirectory)
- throws Exception
- {
- File target = new File( destinationDirectory, source.getName() );
- // Move may fail if target is used (because it is deployed)
- // Use Files.copy instead
- Files.copy(source, target);
- }
-}
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployerMBean.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployerMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/FoeDeployerMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment;
-
-/**
- * MBean interface.
- * @see org.jboss.varia.deployment.convertor.Convertor
- */
-public interface FoeDeployerMBean extends org.jboss.deployment.SubDeployerMBean {
-
- //default object name
- public static final javax.management.ObjectName OBJECT_NAME = org.jboss.mx.util.ObjectNameFactory.create("jboss.system:service=ServiceDeployer");
-
- /**
- * Returns true if the there is a converter available to convert the deployment unit.
- */
- boolean accepts(org.jboss.deployment.DeploymentInfo di) ;
-
- /**
- * At the init phase the deployment unit and its subdeployment units are unpacked.
- */
- void init(org.jboss.deployment.DeploymentInfo di) throws org.jboss.deployment.DeploymentException;
-
- /**
- * At the create phase, the conversion and packing is done.
- */
- void create(org.jboss.deployment.DeploymentInfo di) throws org.jboss.deployment.DeploymentException;
-
- /**
- * This method stops this deployment because it is not of any use anymore (conversion is done)
- */
- void start(org.jboss.deployment.DeploymentInfo di) throws org.jboss.deployment.DeploymentException;
-
- void stop(org.jboss.deployment.DeploymentInfo di) ;
-
- void destroy(org.jboss.deployment.DeploymentInfo di) ;
-
- /**
- * Add a new conveter to the list. If the same converter is added, this new one won't be added, meaning everything stays the same. This method is normally called by a Converter to be called by this deployer to convert.
- * @param converter New Converter to be added
- */
- void addConvertor(org.jboss.varia.deployment.convertor.Convertor converter) ;
-
- /**
- * Removes a conveter from the list of converters. If the converter does not exist nothing happens. This method is normally called by a Converter to be removed from the list if not serving anymore.
- * @param converter Conveter to be removed from the list
- */
- void removeConvertor(org.jboss.varia.deployment.convertor.Convertor converter) ;
-
-}
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/convertor/Convertor.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/convertor/Convertor.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/convertor/Convertor.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment.convertor;
-
-import java.io.File;
-import java.net.URL;
-
-import org.jboss.deployment.DeploymentInfo;
-
-/**
- * Defines the methods of a Converter
- *
- * @author <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @version $Revision$
- *
- * <p><b>20020519 Andreas Schaefer:</b>
- * <ul>
- * <li>Creation</li>
- * </ul>
- */
-public interface Convertor
-{
- // Public --------------------------------------------------------
- /**
- * Checks if the a deployment unit can be converted to a JBoss deployment
- * unit by this converter.
- *
- * @param url The url of the deployment unit to be converted
- *
- * @return True if this converter is able to convert
- */
- public boolean accepts(URL url);
-
- /**
- * Converts the necessary files to make the given deployment deployable
- * into the JBoss
- *
- * @param di Deployment info to be converted
- * @param path Path of the extracted deployment
- **/
- public void convert(DeploymentInfo di, File path)
- throws Exception;
-}
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertor.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertor.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertor.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,306 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment.convertor;
-
-import java.io.File;
-import java.util.Properties;
-import java.util.jar.JarFile;
-import java.net.URL;
-
-import javax.management.JMException;
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.system.ServiceMBeanSupport;
-
-
-/**
- * Converts WebLogic applications.
- *
- * @author <a href="mailto:aloubyansky at hotmail.com">Alex Loubyansky</a>
- * @author <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @version $Revision$
- *
- * <p><b>20020519 Andreas Schaefer:</b>
- * <ul>
- * <li>Creation</li>
- * </ul>
- *
- * @jmx.mbean
- * name="jboss.system:service=Convertor,type=WebLogic"
- * extends="org.jboss.system.ServiceMBean"
- */
-public class WebLogicConvertor
- extends ServiceMBeanSupport
- implements Convertor, WebLogicConvertorMBean
-{
- // Attributes ---------------------------------------
- /** the deployer name this converter is registered with */
- private String deployerName;
-
- /** the version of xsl resources to apply */
- private String wlVersion;
-
- /** remove-table value */
- private String removeTable;
-
- /** datasource name that will be set up for converted bean */
- private String datasource;
-
- /** the datasource mapping for the datasource */
- private String datasourceMapping;
-
- /** xsl parameters used in transformations */
- private Properties xslParams;
-
- // WebLogicConverter implementation -----------------
- /**
- * @jmx.managed-attribute
- */
- public String getDeployer()
- {
- return deployerName;
- }
- /**
- * @jmx.managed-attribute
- */
- public void setDeployer( String name )
- {
- if( deployerName != null && name!= null && deployerName != name )
- {
- // Remove deployer
- try
- {
- server.invoke(
- new ObjectName( deployerName ),
- "removeConvertor",
- new Object[] { this },
- new String[] { this.getClass().getName() }
- );
- }
- catch( JMException jme ) { }
- }
- if( name != null ) deployerName = name;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getWlVersion()
- {
- return wlVersion;
- }
- /**
- * @jmx.managed-attribute
- */
- public void setWlVersion( String wlVersion )
- {
- this.wlVersion = wlVersion;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getRemoveTable()
- {
- return removeTable;
- }
- /**
- * @jmx.managed-attribute
- */
- public void setRemoveTable( String removeTable )
- {
- this.removeTable = removeTable;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getDatasource()
- {
- return datasource;
- }
- /**
- * @jmx.managed-attribute
- */
- public void setDatasource( String datasource )
- {
- this.datasource = datasource;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getDatasourceMapping()
- {
- return datasourceMapping;
- }
- /**
- * @jmx.managed-attribute
- */
- public void setDatasourceMapping( String datasourceMapping )
- {
- this.datasourceMapping = datasourceMapping;
- }
-
- // ServiceMBeanSupport overridding ------------------
- public void startService()
- {
- try
- {
- // init xsl params first
- initXslParams();
-
- server.invoke(
- new ObjectName(deployerName),
- "addConvertor",
- new Object[] { this },
- new String[] { Convertor.class.getName() }
- );
- }
- catch( JMException jme )
- {
- log.error( "Caught exception during startService()", jme );
- }
- }
-
- public void stopService()
- {
- if(deployerName != null)
- {
- // Remove deployer
- try {
- server.invoke(
- new ObjectName(deployerName),
- "removeConvertor",
- new Object[] { this },
- new String[] { this.getClass().getName() }
- );
- }
- catch( JMException jme )
- {
- // Ingore
- }
- }
- }
-
- // Converter implementation ----------------------------------------
- /**
- * Checks if the deployment can be converted to a JBoss deployment
- * by this converter.
- *
- * @param url The url of deployment to be converted
- * @return true if this converter is able to convert
- */
- public boolean accepts(URL url)
- {
- String stringUrl = url.toString();
- JarFile jarFile = null;
- boolean accepted = false;
- try
- {
- jarFile = new JarFile(url.getPath());
- accepted = (jarFile.getEntry("META-INF/weblogic-ejb-jar.xml" ) != null)
- && (stringUrl.endsWith(".wlar") || (stringUrl.endsWith(".wl")))
- || stringUrl.endsWith(".war.wl")
- || stringUrl.endsWith(".ear.wl") ;
- jarFile.close();
- }
- catch(Exception e)
- {
- log.debug("Couldn't create JarFile for " + url.getPath(), e);
- return false;
- }
-
- return accepted;
- }
-
- /**
- * Converts the necessary files to make the given deployment deployable
- * on JBoss
- *
- * @param di The deployment to be converted
- * @param path Path of the extracted deployment
- **/
- public void convert(DeploymentInfo di, File path)
- throws Exception
- {
- Properties xslParams = getXslParams();
- JarTransformer.transform(path, xslParams);
- }
-
- // Public -------------------------------------------
- /**
- * Returns the XSL parameters
- */
- public Properties getXslParams()
- {
- if(xslParams == null)
- {
- log.warn("xmlParams should have been initialized!");
- xslParams = initXslParams();
- }
-
- // xsl resources path
- xslParams.setProperty("resources_path", "resources/" + wlVersion + "/");
-
- // set remove-table
- xslParams.setProperty("remove-table", removeTable);
-
- // datasource
- xslParams.setProperty("datasource", datasource);
-
- // datasource-mapping
- xslParams.setProperty("datasource-mapping", datasourceMapping);
-
- return xslParams;
- }
-
- // Private -------------------------------------------------------
- /**
- * Initializes XSL parameters
- */
- private Properties initXslParams()
- {
- xslParams = new Properties();
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- // path to standardjboss.xml
- URL url = cl.getResource( "standardjboss.xml" );
- if( url != null )
- xslParams.setProperty( "standardjboss",
- new File( url.getFile()).getAbsolutePath() );
- else log.debug( "standardjboss.xml not found." );
-
- // path to standardjbosscmp-jdbc.xml
- url = cl.getResource( "standardjbosscmp-jdbc.xml" );
- if( url != null )
- xslParams.setProperty( "standardjbosscmp-jdbc",
- new File( url.getFile()).getAbsolutePath() );
- else log.debug( "standardjbosscmp-jdbc.xml not found." );
-
- log.debug( "initialized xsl parameters: " + xslParams );
-
- return xslParams;
- }
-}
Deleted: trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertorMBean.java
===================================================================
--- trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertorMBean.java 2009-02-13 14:41:54 UTC (rev 84174)
+++ trunk/varia/src/main/org/jboss/varia/deployment/convertor/WebLogicConvertorMBean.java 2009-02-13 15:14:49 UTC (rev 84175)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.varia.deployment.convertor;
-
-/**
- * MBean interface.
- */
-public interface WebLogicConvertorMBean extends org.jboss.system.ServiceMBean {
-
- //default object name
- public static final javax.management.ObjectName OBJECT_NAME = org.jboss.mx.util.ObjectNameFactory.create("jboss.system:service=Convertor,type=WebLogic");
-
- java.lang.String getDeployer() ;
-
- void setDeployer(java.lang.String name) ;
-
- java.lang.String getWlVersion() ;
-
- void setWlVersion(java.lang.String wlVersion) ;
-
- java.lang.String getRemoveTable() ;
-
- void setRemoveTable(java.lang.String removeTable) ;
-
- java.lang.String getDatasource() ;
-
- void setDatasource(java.lang.String datasource) ;
-
- java.lang.String getDatasourceMapping() ;
-
- void setDatasourceMapping(java.lang.String datasourceMapping) ;
-
-}
More information about the jboss-cvs-commits
mailing list