[jboss-cvs] JBossAS SVN: r81070 - in trunk/system: src/assembly and 17 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 14 10:17:21 EST 2008
Author: dimitris at jboss.org
Date: 2008-11-14 10:17:21 -0500 (Fri, 14 Nov 2008)
New Revision: 81070
Modified:
trunk/system/pom.xml
trunk/system/src/assembly/profileservice-spi.xml
trunk/system/src/main/org/jboss/aop/deployers/temp/Hack.java
trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
trunk/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java
trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
trunk/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java
trunk/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java
trunk/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java
trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java
trunk/system/src/main/org/jboss/deployers/spi/management/KnownDeploymentTypes.java
trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentID.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressEvent.java
trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressListener.java
trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java
trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java
trunk/system/src/main/org/jboss/profileservice/spi/DeploymentContentFlags.java
trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
trunk/system/src/main/org/jboss/profileservice/spi/NoSuchDeploymentException.java
trunk/system/src/main/org/jboss/profileservice/spi/NoSuchProfileException.java
trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
trunk/system/src/main/org/jboss/profileservice/spi/ProfileConfiguration.java
trunk/system/src/main/org/jboss/profileservice/spi/ProfileKey.java
trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java
trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java
trunk/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java
trunk/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java
trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
trunk/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java
trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java
trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java
trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/security/SecurityPolicy.java
trunk/system/src/resources/dtd/jboss-service_4_2.dtd
trunk/system/src/resources/dtd/jboss-service_5_0.dtd
trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
Log:
fix svn properties
Property changes on: trunk/system/pom.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: trunk/system/src/assembly/profileservice-spi.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/aop/deployers/temp/Hack.java
===================================================================
--- trunk/system/src/main/org/jboss/aop/deployers/temp/Hack.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/aop/deployers/temp/Hack.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,44 +1,44 @@
-/*
- * 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.aop.deployers.temp;
-
-import org.jboss.kernel.Kernel;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-
-/**
- * This is a hack to fix the problems caused
- * by aop-mc-int not being in the same classloader
- * as the mc and jbossxb.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class Hack
-{
- public Hack(Kernel kernel) throws Exception
- {
- DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
- resolver.addClassBinding("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.metadata.AOPDeployment");
- resolver.addSchemaParseAnnotations("urn:jboss:aop-beans:1.0", Boolean.FALSE);
- }
-}
+/*
+ * 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.aop.deployers.temp;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+/**
+ * This is a hack to fix the problems caused
+ * by aop-mc-int not being in the same classloader
+ * as the mc and jbossxb.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class Hack
+{
+ public Hack(Kernel kernel) throws Exception
+ {
+ DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+ resolver.addClassBinding("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.metadata.AOPDeployment");
+ resolver.addSchemaParseAnnotations("urn:jboss:aop-beans:1.0", Boolean.FALSE);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/aop/deployers/temp/Hack.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,201 +1,201 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.beans.metadata.spi.AnnotationMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ManagementObjectClass;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-
-/**
- * An InstanceClassFactory for BeanMetaData
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class BeanMetaDataICF
- implements InstanceClassFactory<BeanMetaData>
-{
- private static final Logger log = Logger.getLogger(BeanMetaDataICF.class);
- private KernelController controller;
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- public KernelController getController()
- {
- return controller;
- }
- public void setController(KernelController controller)
- {
- this.controller = controller;
- }
-
- public MetaValueFactory getMetaValueFactory()
- {
- return metaValueFactory;
- }
- public void setMetaValueFactory(MetaValueFactory metaValueFactory)
- {
- this.metaValueFactory = metaValueFactory;
- }
-
- public Object locateBean(String beanName)
- {
- ControllerContext context = getController().getInstalledContext(beanName);
- if (context == null)
- {
- return null;
- }
- return context.getTarget();
- }
-
- public Class<BeanMetaData> getType()
- {
- return BeanMetaData.class;
- }
-
- public Object getComponentName(BeanInfo beanInfo, ManagedProperty property,
- BeanMetaData attachment, MetaValue value)
- {
- return attachment.getName();
- }
-
- public Class<?> getManagedObjectClass(BeanMetaData attachment)
- throws ClassNotFoundException
- {
- Class<?> mocClass = null;
-
- // Look for a ManagementObjectClass annotation
- Set<AnnotationMetaData> annotations = attachment.getAnnotations();
- if(annotations != null)
- {
- for(AnnotationMetaData amd : annotations)
- {
- Annotation ann = amd.getAnnotationInstance();
- if(ann instanceof ManagementObjectClass)
- {
- ManagementObjectClass moc = (ManagementObjectClass) ann;
- mocClass = moc.code();
- log.debug("Saw ManagementObjectClass, "+mocClass+" for bean: "+attachment);
- break;
- }
- }
- }
- // Use the bean from the metadata
- if(mocClass == null)
- {
- String beanClassName = attachment.getBean();
- if(beanClassName != null && beanClassName.length() > 0)
- {
- // TODO: TCL may not be correct
- ClassLoader loader = getClassLoader(attachment);
- mocClass = loader.loadClass(beanClassName);
- log.debug("Using bean class:, "+mocClass+" for bean: "+attachment);
- }
- }
- return mocClass;
- }
-
- public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
- MetaData metaData,
- BeanMetaData attachment)
- {
- // Get the property from the bean
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- Object bean = locateBean(attachment.getName());
- Object value = null;
- MetaValue mvalue = null;
-
- try
- {
- value = propertyInfo.get(bean);
- mvalue = metaValueFactory.create(value, propertyInfo.getType());
- }
- catch(Throwable e)
- {
- log.debug("Failed to get property value for bean: "+beanInfo.getName()
- +", property: "+propertyInfo.getName(), e);
- mvalue = metaValueFactory.create(null, propertyInfo.getType());
- return mvalue;
- }
-
- return mvalue;
- }
-
- public void setValue(BeanInfo beanInfo, ManagedProperty property,
- BeanMetaData attachment, MetaValue value)
- {
- ClassLoader prevLoader = SecurityActions.getContextClassLoader();
- String beanName = attachment.getName();
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
- try
- {
- ClassLoader loader = getClassLoader(attachment);
- // Set the mbean class loader as the TCL
- SecurityActions.setContextClassLoader(loader);
-
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- if(propertyInfo == null)
- throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);
-
- Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
- Object bean = locateBean(beanName);
- propertyInfo.set(bean, plainValue);
- }
- catch(Throwable e)
- {
- throw new IllegalStateException("Failed to set property value: "+name + "/" + beanName, e);
- }
- finally
- {
- SecurityActions.setContextClassLoader(prevLoader);
- }
- }
-
- protected ClassLoader getClassLoader(BeanMetaData bmd)
- {
- ClassLoader loader = null; //Configurator.getClassLoader(bmd);
- // Fallback to TCL if there is no
- if(loader == null)
- loader = SecurityActions.getContextClassLoader();
- return loader;
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementObjectClass;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
+/**
+ * An InstanceClassFactory for BeanMetaData
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class BeanMetaDataICF
+ implements InstanceClassFactory<BeanMetaData>
+{
+ private static final Logger log = Logger.getLogger(BeanMetaDataICF.class);
+ private KernelController controller;
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ public KernelController getController()
+ {
+ return controller;
+ }
+ public void setController(KernelController controller)
+ {
+ this.controller = controller;
+ }
+
+ public MetaValueFactory getMetaValueFactory()
+ {
+ return metaValueFactory;
+ }
+ public void setMetaValueFactory(MetaValueFactory metaValueFactory)
+ {
+ this.metaValueFactory = metaValueFactory;
+ }
+
+ public Object locateBean(String beanName)
+ {
+ ControllerContext context = getController().getInstalledContext(beanName);
+ if (context == null)
+ {
+ return null;
+ }
+ return context.getTarget();
+ }
+
+ public Class<BeanMetaData> getType()
+ {
+ return BeanMetaData.class;
+ }
+
+ public Object getComponentName(BeanInfo beanInfo, ManagedProperty property,
+ BeanMetaData attachment, MetaValue value)
+ {
+ return attachment.getName();
+ }
+
+ public Class<?> getManagedObjectClass(BeanMetaData attachment)
+ throws ClassNotFoundException
+ {
+ Class<?> mocClass = null;
+
+ // Look for a ManagementObjectClass annotation
+ Set<AnnotationMetaData> annotations = attachment.getAnnotations();
+ if(annotations != null)
+ {
+ for(AnnotationMetaData amd : annotations)
+ {
+ Annotation ann = amd.getAnnotationInstance();
+ if(ann instanceof ManagementObjectClass)
+ {
+ ManagementObjectClass moc = (ManagementObjectClass) ann;
+ mocClass = moc.code();
+ log.debug("Saw ManagementObjectClass, "+mocClass+" for bean: "+attachment);
+ break;
+ }
+ }
+ }
+ // Use the bean from the metadata
+ if(mocClass == null)
+ {
+ String beanClassName = attachment.getBean();
+ if(beanClassName != null && beanClassName.length() > 0)
+ {
+ // TODO: TCL may not be correct
+ ClassLoader loader = getClassLoader(attachment);
+ mocClass = loader.loadClass(beanClassName);
+ log.debug("Using bean class:, "+mocClass+" for bean: "+attachment);
+ }
+ }
+ return mocClass;
+ }
+
+ public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData,
+ BeanMetaData attachment)
+ {
+ // Get the property from the bean
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ Object bean = locateBean(attachment.getName());
+ Object value = null;
+ MetaValue mvalue = null;
+
+ try
+ {
+ value = propertyInfo.get(bean);
+ mvalue = metaValueFactory.create(value, propertyInfo.getType());
+ }
+ catch(Throwable e)
+ {
+ log.debug("Failed to get property value for bean: "+beanInfo.getName()
+ +", property: "+propertyInfo.getName(), e);
+ mvalue = metaValueFactory.create(null, propertyInfo.getType());
+ return mvalue;
+ }
+
+ return mvalue;
+ }
+
+ public void setValue(BeanInfo beanInfo, ManagedProperty property,
+ BeanMetaData attachment, MetaValue value)
+ {
+ ClassLoader prevLoader = SecurityActions.getContextClassLoader();
+ String beanName = attachment.getName();
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+ try
+ {
+ ClassLoader loader = getClassLoader(attachment);
+ // Set the mbean class loader as the TCL
+ SecurityActions.setContextClassLoader(loader);
+
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ if(propertyInfo == null)
+ throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);
+
+ Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
+ Object bean = locateBean(beanName);
+ propertyInfo.set(bean, plainValue);
+ }
+ catch(Throwable e)
+ {
+ throw new IllegalStateException("Failed to set property value: "+name + "/" + beanName, e);
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(prevLoader);
+ }
+ }
+
+ protected ClassLoader getClassLoader(BeanMetaData bmd)
+ {
+ ClassLoader loader = null; //Configurator.getClassLoader(bmd);
+ // Fallback to TCL if there is no
+ if(loader == null)
+ loader = SecurityActions.getContextClassLoader();
+ return loader;
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,75 +1,75 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
-import org.jboss.metadata.spi.MetaData;
-
-/**
- * Default managed object creator.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class DefaultManagedObjectCreator implements ManagedObjectCreator
-{
- private static Logger log = Logger.getLogger(DefaultManagedObjectCreator.class);
-
- /**
- * Build managed object.
- *
- * @param unit the deployment unit
- * @param managedObjects map of managed objects
- * @throws DeploymentException for any deployment exception
- */
- public void build(DeploymentUnit unit, Set<String> attachments, Map<String, ManagedObject> managedObjects)
- throws DeploymentException
- {
- MetaData metaData = unit.getMetaData();
- if(metaData != null)
- {
- Object[] all = metaData.getMetaData();
- log.debug("All metaData: " + Arrays.toString(all));
- }
- for(String name : attachments)
- {
- Object instance = unit.getAttachment(name);
- if (instance != null)
- {
- ManagedObjectFactory factory = ManagedObjectFactoryBuilder.create();
- ManagedObject mo = factory.initManagedObject(instance, metaData);
- if (mo != null)
- managedObjects.put(mo.getName(), mo);
- }
- }
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * Default managed object creator.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DefaultManagedObjectCreator implements ManagedObjectCreator
+{
+ private static Logger log = Logger.getLogger(DefaultManagedObjectCreator.class);
+
+ /**
+ * Build managed object.
+ *
+ * @param unit the deployment unit
+ * @param managedObjects map of managed objects
+ * @throws DeploymentException for any deployment exception
+ */
+ public void build(DeploymentUnit unit, Set<String> attachments, Map<String, ManagedObject> managedObjects)
+ throws DeploymentException
+ {
+ MetaData metaData = unit.getMetaData();
+ if(metaData != null)
+ {
+ Object[] all = metaData.getMetaData();
+ log.debug("All metaData: " + Arrays.toString(all));
+ }
+ for(String name : attachments)
+ {
+ Object instance = unit.getAttachment(name);
+ if (instance != null)
+ {
+ ManagedObjectFactory factory = ManagedObjectFactoryBuilder.create();
+ ManagedObject mo = factory.initManagedObject(instance, metaData);
+ if (mo != null)
+ managedObjects.put(mo.getName(), mo);
+ }
+ }
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,126 +1,126 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.MutableManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.types.CollectionMetaType;
-import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.GenericValue;
-import org.jboss.metatype.api.values.GenericValueSupport;
-
-/**
- * ManagedObjectCreator for KernelDeployment
- *
- * @author Scott.Stark at jboss.org
- * @author Ales.Justin at jboss.org
- * @version $Revision:$
- */
-public class KernelDeploymentManagedObjectCreator implements ManagedObjectCreator
-{
- private ManagedObjectFactory mof;
-
- public KernelDeploymentManagedObjectCreator(ManagedObjectFactory mof)
- {
- if (mof == null)
- throw new IllegalArgumentException("Null ManagedObjectFactory.");
- this.mof = mof;
- }
-
- /**
- * Build managed object.
- *
- * @param unit the deployment unit
- * @param managedObjects map of managed objects
- * @throws DeploymentException for any deployment exception
- */
- public void build(DeploymentUnit unit, Set<String> attachments, Map<String, ManagedObject> managedObjects) throws DeploymentException
- {
- KernelDeployment deployment = unit.getAttachment(KernelDeployment.class);
- if(deployment == null)
- return;
-
- List<BeanMetaDataFactory> beanFactories = deployment.getBeanFactories();
-
- // Get the KernelDeployment ManagedObject
- ManagedObject deploymentMO = managedObjects.get(KernelDeployment.class.getName());
- if(deploymentMO == null)
- {
- // Should not happen?
- deploymentMO = mof.createManagedObject(deployment.getClass());
- managedObjects.put(KernelDeployment.class.getName(), deploymentMO);
- }
- // Update the beanFactories value to
- ManagedProperty beanFactoriesMP = deploymentMO.getProperty("beanFactories");
- List<GenericValue> tmp = new ArrayList<GenericValue>();
- CollectionMetaType moType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
- if(beanFactories != null)
- {
- for(BeanMetaDataFactory bmdf : beanFactories)
- {
- // TODO - this is a hack ;-)
- if((bmdf instanceof BeanMetaData) == false)
- continue;
-
- BeanMetaData bmd = (BeanMetaData) bmdf;
- DeploymentUnit compUnit = unit.getComponent(bmd.getName());
- MetaData metaData = compUnit.getMetaData();
- GenericValue gv = getManagedObjectValue(bmd, metaData, deploymentMO);
- if(gv != null)
- tmp.add(gv);
- }
- }
- GenericValue[] mos = new GenericValue[tmp.size()];
- tmp.toArray(mos);
- CollectionValueSupport values = new CollectionValueSupport(moType, mos);
- // This bypasses the write through back to the metadata
- beanFactoriesMP.getFields().setField(Fields.VALUE, values);
- }
-
- protected GenericValue getManagedObjectValue(BeanMetaData bmd, MetaData metaData, ManagedObject parentMO)
- {
- String name = bmd.getName();
- ManagedObject mo = mof.initManagedObject(bmd, null, metaData, name, null);
- if(parentMO != null && mo instanceof MutableManagedObject)
- {
- MutableManagedObject mmo = (MutableManagedObject) mo;
- mmo.setParent(parentMO);
- }
- return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.GenericValueSupport;
+
+/**
+ * ManagedObjectCreator for KernelDeployment
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
+ * @version $Revision:$
+ */
+public class KernelDeploymentManagedObjectCreator implements ManagedObjectCreator
+{
+ private ManagedObjectFactory mof;
+
+ public KernelDeploymentManagedObjectCreator(ManagedObjectFactory mof)
+ {
+ if (mof == null)
+ throw new IllegalArgumentException("Null ManagedObjectFactory.");
+ this.mof = mof;
+ }
+
+ /**
+ * Build managed object.
+ *
+ * @param unit the deployment unit
+ * @param managedObjects map of managed objects
+ * @throws DeploymentException for any deployment exception
+ */
+ public void build(DeploymentUnit unit, Set<String> attachments, Map<String, ManagedObject> managedObjects) throws DeploymentException
+ {
+ KernelDeployment deployment = unit.getAttachment(KernelDeployment.class);
+ if(deployment == null)
+ return;
+
+ List<BeanMetaDataFactory> beanFactories = deployment.getBeanFactories();
+
+ // Get the KernelDeployment ManagedObject
+ ManagedObject deploymentMO = managedObjects.get(KernelDeployment.class.getName());
+ if(deploymentMO == null)
+ {
+ // Should not happen?
+ deploymentMO = mof.createManagedObject(deployment.getClass());
+ managedObjects.put(KernelDeployment.class.getName(), deploymentMO);
+ }
+ // Update the beanFactories value to
+ ManagedProperty beanFactoriesMP = deploymentMO.getProperty("beanFactories");
+ List<GenericValue> tmp = new ArrayList<GenericValue>();
+ CollectionMetaType moType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+ if(beanFactories != null)
+ {
+ for(BeanMetaDataFactory bmdf : beanFactories)
+ {
+ // TODO - this is a hack ;-)
+ if((bmdf instanceof BeanMetaData) == false)
+ continue;
+
+ BeanMetaData bmd = (BeanMetaData) bmdf;
+ DeploymentUnit compUnit = unit.getComponent(bmd.getName());
+ MetaData metaData = compUnit.getMetaData();
+ GenericValue gv = getManagedObjectValue(bmd, metaData, deploymentMO);
+ if(gv != null)
+ tmp.add(gv);
+ }
+ }
+ GenericValue[] mos = new GenericValue[tmp.size()];
+ tmp.toArray(mos);
+ CollectionValueSupport values = new CollectionValueSupport(moType, mos);
+ // This bypasses the write through back to the metadata
+ beanFactoriesMP.getFields().setField(Fields.VALUE, values);
+ }
+
+ protected GenericValue getManagedObjectValue(BeanMetaData bmd, MetaData metaData, ManagedObject parentMO)
+ {
+ String name = bmd.getName();
+ ManagedObject mo = mof.initManagedObject(bmd, null, metaData, name, null);
+ if(parentMO != null && mo instanceof MutableManagedObject)
+ {
+ MutableManagedObject mmo = (MutableManagedObject) mo;
+ mmo.setParent(parentMO);
+ }
+ return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,160 +1,160 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Package privileged actions
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision: 71039 $
- */
-class SecurityActions
-{
- interface TCLAction
- {
- class UTIL
- {
- static TCLAction getTCLAction()
- {
- return System.getSecurityManager() == null ? NON_PRIVILEGED : PRIVILEGED;
- }
-
- static ClassLoader getContextClassLoader()
- {
- return getTCLAction().getContextClassLoader();
- }
-
- static ClassLoader getContextClassLoader(Thread thread)
- {
- return getTCLAction().getContextClassLoader(thread);
- }
-
- static void setContextClassLoader(ClassLoader cl)
- {
- getTCLAction().setContextClassLoader(cl);
- }
-
- static void setContextClassLoader(Thread thread, ClassLoader cl)
- {
- getTCLAction().setContextClassLoader(thread, cl);
- }
- }
-
- TCLAction NON_PRIVILEGED = new TCLAction()
- {
- public ClassLoader getContextClassLoader()
- {
- return Thread.currentThread().getContextClassLoader();
- }
-
- public ClassLoader getContextClassLoader(Thread thread)
- {
- return thread.getContextClassLoader();
- }
-
- public void setContextClassLoader(ClassLoader cl)
- {
- Thread.currentThread().setContextClassLoader(cl);
- }
-
- public void setContextClassLoader(Thread thread, ClassLoader cl)
- {
- thread.setContextClassLoader(cl);
- }
- };
-
- TCLAction PRIVILEGED = new TCLAction()
- {
- private final PrivilegedAction<ClassLoader> getTCLPrivilegedAction = new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- };
-
- public ClassLoader getContextClassLoader()
- {
- return AccessController.doPrivileged(getTCLPrivilegedAction);
- }
-
- public ClassLoader getContextClassLoader(final Thread thread)
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return thread.getContextClassLoader();
- }
- });
- }
-
- public void setContextClassLoader(final ClassLoader cl)
- {
- AccessController.doPrivileged(
- new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- Thread.currentThread().setContextClassLoader(cl);
- return null;
- }
- }
- );
- }
-
- public void setContextClassLoader(final Thread thread, final ClassLoader cl)
- {
- AccessController.doPrivileged(
- new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- thread.setContextClassLoader(cl);
- return null;
- }
- }
- );
- }
- };
-
- ClassLoader getContextClassLoader();
-
- ClassLoader getContextClassLoader(Thread thread);
-
- void setContextClassLoader(ClassLoader cl);
-
- void setContextClassLoader(Thread thread, ClassLoader cl);
- }
-
- static ClassLoader getContextClassLoader()
- {
- return TCLAction.UTIL.getContextClassLoader();
- }
- static void setContextClassLoader(ClassLoader loader)
- {
- TCLAction.UTIL.setContextClassLoader(loader);
- }
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Package privileged actions
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 71039 $
+ */
+class SecurityActions
+{
+ interface TCLAction
+ {
+ class UTIL
+ {
+ static TCLAction getTCLAction()
+ {
+ return System.getSecurityManager() == null ? NON_PRIVILEGED : PRIVILEGED;
+ }
+
+ static ClassLoader getContextClassLoader()
+ {
+ return getTCLAction().getContextClassLoader();
+ }
+
+ static ClassLoader getContextClassLoader(Thread thread)
+ {
+ return getTCLAction().getContextClassLoader(thread);
+ }
+
+ static void setContextClassLoader(ClassLoader cl)
+ {
+ getTCLAction().setContextClassLoader(cl);
+ }
+
+ static void setContextClassLoader(Thread thread, ClassLoader cl)
+ {
+ getTCLAction().setContextClassLoader(thread, cl);
+ }
+ }
+
+ TCLAction NON_PRIVILEGED = new TCLAction()
+ {
+ public ClassLoader getContextClassLoader()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ public ClassLoader getContextClassLoader(Thread thread)
+ {
+ return thread.getContextClassLoader();
+ }
+
+ public void setContextClassLoader(ClassLoader cl)
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+
+ public void setContextClassLoader(Thread thread, ClassLoader cl)
+ {
+ thread.setContextClassLoader(cl);
+ }
+ };
+
+ TCLAction PRIVILEGED = new TCLAction()
+ {
+ private final PrivilegedAction<ClassLoader> getTCLPrivilegedAction = new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ };
+
+ public ClassLoader getContextClassLoader()
+ {
+ return AccessController.doPrivileged(getTCLPrivilegedAction);
+ }
+
+ public ClassLoader getContextClassLoader(final Thread thread)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return thread.getContextClassLoader();
+ }
+ });
+ }
+
+ public void setContextClassLoader(final ClassLoader cl)
+ {
+ AccessController.doPrivileged(
+ new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ return null;
+ }
+ }
+ );
+ }
+
+ public void setContextClassLoader(final Thread thread, final ClassLoader cl)
+ {
+ AccessController.doPrivileged(
+ new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ thread.setContextClassLoader(cl);
+ return null;
+ }
+ }
+ );
+ }
+ };
+
+ ClassLoader getContextClassLoader();
+
+ ClassLoader getContextClassLoader(Thread thread);
+
+ void setContextClassLoader(ClassLoader cl);
+
+ void setContextClassLoader(Thread thread, ClassLoader cl);
+ }
+
+ static ClassLoader getContextClassLoader()
+ {
+ return TCLAction.UTIL.getContextClassLoader();
+ }
+ static void setContextClassLoader(ClassLoader loader)
+ {
+ TCLAction.UTIL.setContextClassLoader(loader);
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,270 +1,270 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
-import org.jboss.deployers.spi.management.KnownDeploymentTypes;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.managed.api.annotation.ManagementDeployment;
-import org.jboss.managed.api.annotation.ManagementConstants;
-import org.jboss.managed.plugins.ManagedDeploymentImpl;
-
-/**
- * A ManagedDeploymentCreator that looks for {@linkplain KnownDeploymentTypes}
- * attachments and maps those to the {@linkplain ManagedDeployment#getTypes()}
- * set.
- *
- * This also does attachment type mapping based on the registered attachment
- * type class to deployment type mapping.
- * @see {@link #addAttachmentType(Class, String)}
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class TypedManagedDeploymentCreator
- implements ManagedDeploymentCreator
-{
- private static Logger log = Logger.getLogger(TypedManagedDeploymentCreator.class);
- /** A mapping from a deployment attachment type to the {@link ManagedDeployment#addType(String)} type */
- private Map<Class, String> attachmentToTypeMap = new ConcurrentHashMap<Class, String>();
- private Map<Class, List<TypeVersion>> attachmentToTypeVersionsMap = new ConcurrentHashMap<Class, List<TypeVersion>>();
-
- /**
- *
- */
- public ManagedDeployment build(DeploymentUnit unit,
- Map<String, ManagedObject> unitMOs,
- ManagedDeployment parent)
- {
- if(unit.getSimpleName().startsWith("testEjb2xDeployment"))
- log.info("Processing testEjb2xDeployment");
-
- DeploymentPhase phase = unit.getAttachment(DeploymentPhase.class);
- ManagementDeployment mdAnnotation = null;
- for(ManagedObject mo : unitMOs.values())
- {
- Map<String, Annotation> annotations = mo.getAnnotations();
- if(annotations != null && mdAnnotation == null)
- mdAnnotation = (ManagementDeployment) annotations.get(ManagementDeployment.class.getName());
- }
- String simpleName = unit.getSimpleName();
- String[] types = {};
- if(mdAnnotation != null)
- {
- if(phase == null)
- phase = mdAnnotation.phase();
- String mdaSimpleName = mdAnnotation.simpleName();
- if(mdaSimpleName.length() > 0 && ManagementConstants.GENERATED.equals(mdaSimpleName) == false)
- simpleName = mdAnnotation.simpleName();
- types = mdAnnotation.types();
- }
- if( phase == null )
- phase = DeploymentPhase.APPLICATION;
-
- ManagedDeployment md = new ManagedDeploymentImpl(unit.getName(), simpleName, phase, parent, unitMOs);
- if(types.length > 0)
- {
- for(String type : types)
- addType(md, type);
- }
-
- // Check for KnownDeploymentTypes attachment(s)
- Set<? extends KnownDeploymentTypes> knownTypes = unit.getAllMetaData(KnownDeploymentTypes.class);
- if(knownTypes != null)
- {
- for(KnownDeploymentTypes type : knownTypes)
- {
- addType(md, type.getType());
- }
- }
-
- // Check for attachment to type mappings
- for(Class attachmentType : attachmentToTypeMap.keySet())
- {
- if(unit.isAttachmentPresent(attachmentType))
- {
- String type = attachmentToTypeMap.get(attachmentType);
- addType(md, type);
- }
- }
-
- //
- for(Class attachmentType : attachmentToTypeVersionsMap.keySet())
- {
- if(unit.isAttachmentPresent(attachmentType))
- {
- List<TypeVersion> versions = attachmentToTypeVersionsMap.get(attachmentType);
- Object attachment = unit.getAttachment(attachmentType);
- if(attachment == null)
- continue;
-
- for(TypeVersion tv : versions)
- {
- String version = getVersion(attachment, tv.versionGetter);
- if(version == null)
- continue;
-
- Matcher m = tv.versionPattern.matcher(version);
- if(m.matches())
- addType(md, tv.type);
- }
- }
- }
- return md;
- }
-
- /**
- *
- * @param attachmentType
- * @param deploymentType
- */
- public void addAttachmentType(Class attachmentType, String deploymentType)
- {
- log.debug("addAttachmentType, "+attachmentType+":"+deploymentType);
- attachmentToTypeMap.put(attachmentType, deploymentType);
- }
- public void addVersionedAttachmentType(Class attachmentType, String deploymentType,
- String versionPattern)
- {
- addVersionedAttachmentType(attachmentType, deploymentType, versionPattern, "getVersion");
- }
- public void addVersionedAttachmentType(Class attachmentType, String deploymentType,
- String versionPattern, String versionGetterName)
- {
- Pattern p = Pattern.compile(versionPattern);
- log.debug("addVersionedAttachmentType, "+attachmentType+":"+deploymentType
- +", version: "+versionPattern);
- TypeVersion tv = new TypeVersion(deploymentType, p, versionGetterName);
- List<TypeVersion> tvlist = attachmentToTypeVersionsMap.get(attachmentType);
- if(tvlist == null)
- {
- tvlist = new ArrayList<TypeVersion>();
- attachmentToTypeVersionsMap.put(attachmentType, tvlist);
- }
- tvlist.add(tv);
- }
-
- public void removeAttachmentType(Class attachmentType)
- {
- log.debug("removeAttachmentType, "+attachmentType);
- attachmentToTypeMap.remove(attachmentType);
- }
- public void removeVersionedAttachmentType(Class attachmentType, String deploymentType)
- {
- log.debug("removeVersionedAttachmentType, "+attachmentType);
- List<TypeVersion> tvlist = attachmentToTypeVersionsMap.get(attachmentType);
- if(tvlist != null)
- {
- Iterator<TypeVersion> iter = tvlist.iterator();
- while(iter.hasNext())
- {
- TypeVersion tv = iter.next();
- if(deploymentType.equals(tv.type))
- iter.remove();
- }
- attachmentToTypeVersionsMap.put(attachmentType, tvlist);
- if(tvlist.size() == 0)
- attachmentToTypeVersionsMap.remove(attachmentType);
- }
- }
-
- /**
- * Look for a String getterName method using reflection
- * @param attachment
- * @param getterName - the method name to call to get the version
- * @return the attachment version if found, null otherwise
- */
- private String getVersion(Object attachment, String getterName)
- {
- String version = null;
- try
- {
- Class[] parameterTypes = {};
- Method getVersion = attachment.getClass().getMethod(getterName, parameterTypes);
- Object[] args = {};
- version = (String) getVersion.invoke(attachment, args);
- }
- catch(Throwable t)
- {
- log.debug("Failed to get version:"+t);
- }
- return version;
- }
-
- private void addType(ManagedDeployment md, String type)
- {
- if(md.getTypes() == null)
- md.setTypes(new HashSet<String>());
- md.addType(type);
- }
-
- static class TypeVersion
- {
- private String type;
- private Pattern versionPattern;
- private String versionGetter;
-
- public TypeVersion(String type, Pattern versionPattern, String versionGetter)
- {
- super();
- this.type = type;
- this.versionPattern = versionPattern;
- this.versionGetter = versionGetter;
- }
- }
- public static void main(String[] args)
- {
- Pattern p = Pattern.compile("3.*");
- Matcher m = p.matcher("3.0");
- System.out.println("3.0 matches: "+m.matches());
- m = p.matcher("3.1");
- System.out.println("3.1 matches: "+m.matches());
- m = p.matcher("3.x");
- System.out.println("3.x matches: "+m.matches());
- m = p.matcher("2.1");
- System.out.println("2.1 matches: "+m.matches());
-
- Pattern p2x = Pattern.compile("[1-2].*");
- m = p2x.matcher("3.1");
- System.out.println("3.1 is 2x: "+m.matches());
- m = p2x.matcher("1.1");
- System.out.println("1.1 is 2x: "+m.matches());
- m = p2x.matcher("2.1");
- System.out.println("2.1 is 2x: "+m.matches());
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.plugins.managed;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
+import org.jboss.deployers.spi.management.KnownDeploymentTypes;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.managed.api.annotation.ManagementDeployment;
+import org.jboss.managed.api.annotation.ManagementConstants;
+import org.jboss.managed.plugins.ManagedDeploymentImpl;
+
+/**
+ * A ManagedDeploymentCreator that looks for {@linkplain KnownDeploymentTypes}
+ * attachments and maps those to the {@linkplain ManagedDeployment#getTypes()}
+ * set.
+ *
+ * This also does attachment type mapping based on the registered attachment
+ * type class to deployment type mapping.
+ * @see {@link #addAttachmentType(Class, String)}
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class TypedManagedDeploymentCreator
+ implements ManagedDeploymentCreator
+{
+ private static Logger log = Logger.getLogger(TypedManagedDeploymentCreator.class);
+ /** A mapping from a deployment attachment type to the {@link ManagedDeployment#addType(String)} type */
+ private Map<Class, String> attachmentToTypeMap = new ConcurrentHashMap<Class, String>();
+ private Map<Class, List<TypeVersion>> attachmentToTypeVersionsMap = new ConcurrentHashMap<Class, List<TypeVersion>>();
+
+ /**
+ *
+ */
+ public ManagedDeployment build(DeploymentUnit unit,
+ Map<String, ManagedObject> unitMOs,
+ ManagedDeployment parent)
+ {
+ if(unit.getSimpleName().startsWith("testEjb2xDeployment"))
+ log.info("Processing testEjb2xDeployment");
+
+ DeploymentPhase phase = unit.getAttachment(DeploymentPhase.class);
+ ManagementDeployment mdAnnotation = null;
+ for(ManagedObject mo : unitMOs.values())
+ {
+ Map<String, Annotation> annotations = mo.getAnnotations();
+ if(annotations != null && mdAnnotation == null)
+ mdAnnotation = (ManagementDeployment) annotations.get(ManagementDeployment.class.getName());
+ }
+ String simpleName = unit.getSimpleName();
+ String[] types = {};
+ if(mdAnnotation != null)
+ {
+ if(phase == null)
+ phase = mdAnnotation.phase();
+ String mdaSimpleName = mdAnnotation.simpleName();
+ if(mdaSimpleName.length() > 0 && ManagementConstants.GENERATED.equals(mdaSimpleName) == false)
+ simpleName = mdAnnotation.simpleName();
+ types = mdAnnotation.types();
+ }
+ if( phase == null )
+ phase = DeploymentPhase.APPLICATION;
+
+ ManagedDeployment md = new ManagedDeploymentImpl(unit.getName(), simpleName, phase, parent, unitMOs);
+ if(types.length > 0)
+ {
+ for(String type : types)
+ addType(md, type);
+ }
+
+ // Check for KnownDeploymentTypes attachment(s)
+ Set<? extends KnownDeploymentTypes> knownTypes = unit.getAllMetaData(KnownDeploymentTypes.class);
+ if(knownTypes != null)
+ {
+ for(KnownDeploymentTypes type : knownTypes)
+ {
+ addType(md, type.getType());
+ }
+ }
+
+ // Check for attachment to type mappings
+ for(Class attachmentType : attachmentToTypeMap.keySet())
+ {
+ if(unit.isAttachmentPresent(attachmentType))
+ {
+ String type = attachmentToTypeMap.get(attachmentType);
+ addType(md, type);
+ }
+ }
+
+ //
+ for(Class attachmentType : attachmentToTypeVersionsMap.keySet())
+ {
+ if(unit.isAttachmentPresent(attachmentType))
+ {
+ List<TypeVersion> versions = attachmentToTypeVersionsMap.get(attachmentType);
+ Object attachment = unit.getAttachment(attachmentType);
+ if(attachment == null)
+ continue;
+
+ for(TypeVersion tv : versions)
+ {
+ String version = getVersion(attachment, tv.versionGetter);
+ if(version == null)
+ continue;
+
+ Matcher m = tv.versionPattern.matcher(version);
+ if(m.matches())
+ addType(md, tv.type);
+ }
+ }
+ }
+ return md;
+ }
+
+ /**
+ *
+ * @param attachmentType
+ * @param deploymentType
+ */
+ public void addAttachmentType(Class attachmentType, String deploymentType)
+ {
+ log.debug("addAttachmentType, "+attachmentType+":"+deploymentType);
+ attachmentToTypeMap.put(attachmentType, deploymentType);
+ }
+ public void addVersionedAttachmentType(Class attachmentType, String deploymentType,
+ String versionPattern)
+ {
+ addVersionedAttachmentType(attachmentType, deploymentType, versionPattern, "getVersion");
+ }
+ public void addVersionedAttachmentType(Class attachmentType, String deploymentType,
+ String versionPattern, String versionGetterName)
+ {
+ Pattern p = Pattern.compile(versionPattern);
+ log.debug("addVersionedAttachmentType, "+attachmentType+":"+deploymentType
+ +", version: "+versionPattern);
+ TypeVersion tv = new TypeVersion(deploymentType, p, versionGetterName);
+ List<TypeVersion> tvlist = attachmentToTypeVersionsMap.get(attachmentType);
+ if(tvlist == null)
+ {
+ tvlist = new ArrayList<TypeVersion>();
+ attachmentToTypeVersionsMap.put(attachmentType, tvlist);
+ }
+ tvlist.add(tv);
+ }
+
+ public void removeAttachmentType(Class attachmentType)
+ {
+ log.debug("removeAttachmentType, "+attachmentType);
+ attachmentToTypeMap.remove(attachmentType);
+ }
+ public void removeVersionedAttachmentType(Class attachmentType, String deploymentType)
+ {
+ log.debug("removeVersionedAttachmentType, "+attachmentType);
+ List<TypeVersion> tvlist = attachmentToTypeVersionsMap.get(attachmentType);
+ if(tvlist != null)
+ {
+ Iterator<TypeVersion> iter = tvlist.iterator();
+ while(iter.hasNext())
+ {
+ TypeVersion tv = iter.next();
+ if(deploymentType.equals(tv.type))
+ iter.remove();
+ }
+ attachmentToTypeVersionsMap.put(attachmentType, tvlist);
+ if(tvlist.size() == 0)
+ attachmentToTypeVersionsMap.remove(attachmentType);
+ }
+ }
+
+ /**
+ * Look for a String getterName method using reflection
+ * @param attachment
+ * @param getterName - the method name to call to get the version
+ * @return the attachment version if found, null otherwise
+ */
+ private String getVersion(Object attachment, String getterName)
+ {
+ String version = null;
+ try
+ {
+ Class[] parameterTypes = {};
+ Method getVersion = attachment.getClass().getMethod(getterName, parameterTypes);
+ Object[] args = {};
+ version = (String) getVersion.invoke(attachment, args);
+ }
+ catch(Throwable t)
+ {
+ log.debug("Failed to get version:"+t);
+ }
+ return version;
+ }
+
+ private void addType(ManagedDeployment md, String type)
+ {
+ if(md.getTypes() == null)
+ md.setTypes(new HashSet<String>());
+ md.addType(type);
+ }
+
+ static class TypeVersion
+ {
+ private String type;
+ private Pattern versionPattern;
+ private String versionGetter;
+
+ public TypeVersion(String type, Pattern versionPattern, String versionGetter)
+ {
+ super();
+ this.type = type;
+ this.versionPattern = versionPattern;
+ this.versionGetter = versionGetter;
+ }
+ }
+ public static void main(String[] args)
+ {
+ Pattern p = Pattern.compile("3.*");
+ Matcher m = p.matcher("3.0");
+ System.out.println("3.0 matches: "+m.matches());
+ m = p.matcher("3.1");
+ System.out.println("3.1 matches: "+m.matches());
+ m = p.matcher("3.x");
+ System.out.println("3.x matches: "+m.matches());
+ m = p.matcher("2.1");
+ System.out.println("2.1 matches: "+m.matches());
+
+ Pattern p2x = Pattern.compile("[1-2].*");
+ m = p2x.matcher("3.1");
+ System.out.println("3.1 is 2x: "+m.matches());
+ m = p2x.matcher("1.1");
+ System.out.println("1.1 is 2x: "+m.matches());
+ m = p2x.matcher("2.1");
+ System.out.println("2.1 is 2x: "+m.matches());
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,622 +1,622 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.plugins.scanner;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.logging.Logger;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-
-/**
- * A DeploymentScanner built on the ProfileService and MainDeployer.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class VFSDeploymentScannerImpl
- implements Runnable
-{
- private static final Logger log = Logger.getLogger(VFSDeploymentScannerImpl.class);
- // Private Data --------------------------------------------------
- private MainDeployer mainDeployer;
-
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
-
- /** */
- private VirtualFileFilter filter;
- /** The ExecutorService/ThreadPool for performing scans */
- private ScheduledExecutorService scanExecutor;
- private ScheduledFuture activeScan;
-
- /** The URIfied ServerHomeURL */
- private URI serverHomeURI;
-
- /** The list of URIs to scan */
- private List<URI> uriList = Collections.synchronizedList(new ArrayList<URI>());
-
- /** The list of VirtualFiles to scan */
- private List<VirtualFile> vdfList = Collections.synchronizedList(new ArrayList<VirtualFile>());
-
- /** Whether to search for files inside directories whose names containing no dots */
- private boolean doRecursiveSearch = true;
- /** Period in ms between deployment scans */
- private long scanPeriod = 5000;
- private int scanCount;
-
- /** A set of scanned VirtualFiles which have been deployed */
- private Map<VirtualFile, DeploymentInfo> deployedMap = new ConcurrentHashMap<VirtualFile, DeploymentInfo>();
-
- // Constructor ---------------------------------------------------
-
- public VFSDeploymentScannerImpl()
- {
- // empty
- }
-
- // Attributes ----------------------------------------------------
-
- public void setMainDeployer(MainDeployer deployer)
- {
- this.mainDeployer = deployer;
- }
-
- public VirtualFileFilter getFilterInstance()
- {
- return filter;
- }
- public void setFilterInstance(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
-
- /**
- * @return Returns the scanExecutor.
- */
- public ScheduledExecutorService getScanExecutor()
- {
- return this.scanExecutor;
- }
-
- /**
- * @param scanExecutor The scanExecutor to set.
- */
- public void setScanExecutor(ScheduledExecutorService scanExecutor)
- {
- this.scanExecutor = scanExecutor;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.deployment.scanner.VFSDeploymentScanner#getScanPeriod()
- */
- public long getScanPeriod()
- {
- return scanPeriod;
- }
- /* (non-Javadoc)
- * @see org.jboss.deployment.scanner.VFSDeploymentScanner#setScanPeriod(long)
- */
- public void setScanPeriod(long period)
- {
- this.scanPeriod = period;
- }
-
- /**
- * Are deployment scans enabled.
- *
- * @return whether scan is enabled
- */
- public boolean isScanEnabled()
- {
- return activeScan != null;
- }
-
- public synchronized int getScanCount()
- {
- return scanCount;
- }
- public synchronized void resetScanCount()
- {
- this.scanCount = 0;
- }
-
- /**
- * Enable/disable deployment scans.
- * @param scanEnabled true to enable scans, false to disable.
- */
- public synchronized void setScanEnabled(boolean scanEnabled)
- {
- if( scanEnabled == true && activeScan == null )
- {
- activeScan = this.scanExecutor.scheduleWithFixedDelay(this, 0,
- scanPeriod, TimeUnit.MILLISECONDS);
- }
- else if( scanEnabled == false && activeScan != null )
- {
- activeScan.cancel(true);
- activeScan = null;
- }
- }
-
- /**
- * Set the urls to scan
- *
- * @param listspec the urls
- * @throws URISyntaxException
- * @throws IOException
- */
- public void setURIs(final String listspec) throws URISyntaxException, IOException
- {
- if (listspec == null)
- {
- this.uriList.clear();
- return;
- }
- List<URI> list = new LinkedList<URI>();
-
- StringTokenizer stok = new StringTokenizer(listspec, ",");
- while (stok.hasMoreTokens())
- {
- String urispec = stok.nextToken().trim();
-
- log.debug("Adding URI from spec: " + urispec);
-
- URI uri = makeURI(urispec);
-
- log.debug("URI: " + uri);
-
- list.add(uri);
- }
- setURIList(list);
- }
-
- /**
- * Set uris to scan
- *
- * @param list the urls to scan
- * @throws IOException
- */
- public void setURIList(final List<URI> list) throws IOException
- {
- if (list == null)
- {
- return;
- }
-
- // start out with a fresh list
- uriList.clear();
-
- for(int n = 0; n < list.size(); n ++)
- {
- URI uri = list.get(n);
- if (uri == null)
- {
- throw new IllegalArgumentException("list element["+n+"] is null");
- }
- addURI(uri);
- }
- log.debug("URI list: " + uriList);
- }
-
- public List<URI> getURIList()
- {
- return new ArrayList<URI>(uriList);
- }
-
- public void setRecursiveSearch(boolean recurse)
- {
- doRecursiveSearch = recurse;
- }
-
- public boolean getRecursiveSearch()
- {
- return doRecursiveSearch;
- }
-
- // Operations ----------------------------------------------------
-
- public void addURI(final URI uri) throws IOException
- {
- if (uri == null)
- {
- throw new NullPointerException("uri argument cannot be null");
- }
- if( uriList.add(uri) == true )
- {
- log.debug("Added URI: " + uri);
- VirtualFile vf = VFS.getRoot(uri);
- vdfList.add(vf);
- }
- }
-
- public void removeURI(final URI uri)
- throws IOException
- {
- if (uri == null)
- {
- throw new NullPointerException("uri argument cannot be null");
- }
- VirtualFile vf = VFS.getRoot(uri);
- vdfList.remove(vf);
- boolean success = uriList.remove(uri);
-
- if (success)
- {
- log.debug("Removed URI: " + uri);
- }
- }
-
- public boolean hasURI(final URI uri)
- {
- if (uri == null)
- {
- throw new NullPointerException("uri argument cannot be null");
- }
- return uriList.contains(uri);
- }
-
- public void start() throws Exception
- {
- // synchronize uriList and vdfList because only at this point
- // setVirtualFileFactory() injection has been performed
- vdfList.clear();
- for (URI uri : uriList)
- {
- VirtualFile vf = VFS.getRoot(uri);
- vdfList.add(vf);
- }
-
- // Default to a single thread executor
- if( scanExecutor == null )
- {
- scanExecutor = Executors.newSingleThreadScheduledExecutor(
- new ThreadFactory()
- {
- public Thread newThread(Runnable r)
- {
- return new Thread(r, "VFSDeploymentScanner");
- }
- }
- );
- }
- activeScan = scanExecutor.scheduleWithFixedDelay(this, 0,
- scanPeriod, TimeUnit.MILLISECONDS);
- }
-
- /**
- * Executes scan
- *
- */
- public void run()
- {
- try
- {
- scan();
- }
- catch(Throwable e)
- {
- log.warn("Scan failed", e);
- }
- finally
- {
- incScanCount();
- }
- }
-
- public void stop()
- {
- if( activeScan != null )
- {
- activeScan.cancel(true);
- activeScan = null;
- }
- }
-
- public synchronized void scan() throws Exception
- {
- if (vdfList == null)
- {
- throw new IllegalStateException("not initialized");
- }
- boolean trace = log.isTraceEnabled();
-
- // Scan for deployments
- log.debug("Begin deployment scan");
-
- // VirtualFiles to deploy
- List<VirtualFile> toDeployList = new LinkedList<VirtualFile>();
- synchronized (vdfList)
- {
- for (VirtualFile vf : vdfList)
- {
- if( trace )
- log.trace("Checking file: "+vf);
- if (vf.isLeaf())
- {
- // treat this as a deployable unit
- toDeployList.add(vf);
- }
- else
- {
- // process (possibly recursively) the dir
- addDeployments(toDeployList, vf);
- }
- }
- }
-
- if (trace)
- {
- log.trace("toDeployList: "+toDeployList);
- }
- LinkedList<VirtualFile> toRemoveList = new LinkedList<VirtualFile>();
- LinkedList<VirtualFile> toCheckForUpdateList = new LinkedList<VirtualFile>();
-
- synchronized (deployedMap)
- {
- // remove previously deployed URLs no longer needed
- Iterator<VirtualFile> iter = deployedMap.keySet().iterator();
- while( iter.hasNext() )
- {
- VirtualFile vf = iter.next();
- if (toDeployList.contains(vf))
- {
- toCheckForUpdateList.add(vf);
- }
- else
- {
- toRemoveList.add(vf);
- }
- }
- }
-
- // ********
- // Undeploy
- // ********
-
- for (VirtualFile vf : toRemoveList)
- {
- undeploy(vf);
- }
-
- // ********
- // Redeploy
- // ********
-
- // compute the DeployedURL list to update
- ArrayList<VirtualFile> toUpdateList = new ArrayList<VirtualFile>(toCheckForUpdateList.size());
- for (VirtualFile vf : toUpdateList)
- {
- DeploymentInfo info = deployedMap.get(vf);
- long modified = vf.getLastModified();
- Long prevLastDeployed = info.lastModified;;
- if (prevLastDeployed.compareTo(modified) < 0)
- {
- info.lastModified = modified;
- if (trace)
- {
- log.trace("Re-deploying " + vf);
- }
- toUpdateList.add(vf);
- }
- }
-
- // sort to update list
- //Collections.sort(toUpdateList, sorter);
-
- // Undeploy in order
- for (int i = toUpdateList.size() - 1; i >= 0; i--)
- {
- VirtualFile vf = toUpdateList.get(i);
- undeploy(vf);
- }
-
- // Deploy in order
- for (int i = 0; i < toUpdateList.size(); i++)
- {
- VirtualFile vf = toUpdateList.get(i);
- deploy(vf);
- }
-
- // ******
- // Deploy
- // ******
-
- //Collections.sort(toDeployList, sorter);
- for (Iterator i = toDeployList.iterator(); i.hasNext();)
- {
- VirtualFile vf = (VirtualFile)i.next();
-
- // if vf is not deployed already, deploy it
- if (!deployedMap.containsKey(vf))
- {
- deploy(vf);
- }
-
- // vf must have been deployed by now, so remove it from list
- i.remove();
-
- }
- log.debug("End deployment scan");
- }
-
- /**
- * Inc the scanCount and to a notifyAll.
- *
- */
- protected synchronized void incScanCount()
- {
- scanCount ++;
- notifyAll();
- }
-
- // Private -------------------------------------------------------
-
- /**
- * A helper to make a URI from a full/partial urispec
- */
- private URI makeURI(String urispec) throws URISyntaxException
- {
- // First replace URI with appropriate properties
- urispec = StringPropertyReplacer.replaceProperties(urispec);
- return serverHomeURI.resolve(urispec);
- }
-
- /**
- * A helper to find all deployments under a directory vf
- * and add them to the supplied list.
- *
- * We may recurse.
- */
- private void addDeployments(List<VirtualFile> list, VirtualFile root)
- throws IOException
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile vf : components)
- {
- if (vf.isLeaf())
- {
- // the first arg in filter.accept is not used!
- if (filter == null || filter.accepts(vf))
- {
- list.add(vf);
- }
- }
- else
- {
- if (vf.getName().indexOf('.') == -1 && this.doRecursiveSearch)
- {
- // recurse if not '.' in name and recursive search is enabled
- addDeployments(list, vf);
- }
- else
- {
- list.add(vf);
- }
- }
- }
- }
-
- /**
- * A helper to deploy the given vf using the deployer.
- */
- private void deploy(final VirtualFile vf)
- {
- // If the deployer is null simply ignore the request
- log.debug("Deploying: " + vf);
- Deployment deployment = deploymentFactory.createVFSDeployment(vf);
- try
- {
- mainDeployer.addDeployment(deployment);
- mainDeployer.process();
- }
- catch (Exception e)
- {
- log.warn("Failed to deploy: " + vf, e);
- // TODO: somehow need to ignore bad deployments to avoid repeated errors
- return;
- }
-
- /* TODO: this differs from the previous behavior. We would need a type to metainf location
- if we want to watch the same file as jboss4. But since not all files have a deployment
- descriptor, we need to be able to watch the deployment root anyway.
- */
- try
- {
- DeploymentInfo info = new DeploymentInfo(deployment, vf.getLastModified());
- if (!deployedMap.containsKey(vf))
- {
- deployedMap.put(vf, info);
- }
- }
- catch(IOException e)
- {
- log.warn("Failed to obtain lastModified for: "+vf, e);
- }
- }
-
- /**
- * A helper to undeploy the given vf using the deployer.
- */
- private void undeploy(final VirtualFile vf)
- {
- try
- {
- log.debug("Undeploying: " + vf);
- DeploymentInfo info = deployedMap.remove(vf);
- mainDeployer.removeDeployment(info.deployment);
- }
- catch (Exception e)
- {
- log.error("Failed to undeploy: " + vf, e);
- }
- }
-
- /**
- * DeploymentInfo.
- */
- private class DeploymentInfo
- {
- /** The deployment */
- Deployment deployment;
-
- /** The last modified time */
- long lastModified;
-
- /**
- * Create a new DeploymentInfo.
- *
- * @param deployment the deployment
- * @param lastModified the last modified
- */
- public DeploymentInfo(Deployment deployment, long lastModified)
- {
- if (deployment == null)
- throw new IllegalArgumentException("Null deployment");
- this.deployment = deployment;
- this.lastModified = lastModified;
- }
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.plugins.scanner;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.logging.Logger;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+
+/**
+ * A DeploymentScanner built on the ProfileService and MainDeployer.
+ *
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class VFSDeploymentScannerImpl
+ implements Runnable
+{
+ private static final Logger log = Logger.getLogger(VFSDeploymentScannerImpl.class);
+ // Private Data --------------------------------------------------
+ private MainDeployer mainDeployer;
+
+ /** The deployment factory */
+ private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+
+ /** */
+ private VirtualFileFilter filter;
+ /** The ExecutorService/ThreadPool for performing scans */
+ private ScheduledExecutorService scanExecutor;
+ private ScheduledFuture activeScan;
+
+ /** The URIfied ServerHomeURL */
+ private URI serverHomeURI;
+
+ /** The list of URIs to scan */
+ private List<URI> uriList = Collections.synchronizedList(new ArrayList<URI>());
+
+ /** The list of VirtualFiles to scan */
+ private List<VirtualFile> vdfList = Collections.synchronizedList(new ArrayList<VirtualFile>());
+
+ /** Whether to search for files inside directories whose names containing no dots */
+ private boolean doRecursiveSearch = true;
+ /** Period in ms between deployment scans */
+ private long scanPeriod = 5000;
+ private int scanCount;
+
+ /** A set of scanned VirtualFiles which have been deployed */
+ private Map<VirtualFile, DeploymentInfo> deployedMap = new ConcurrentHashMap<VirtualFile, DeploymentInfo>();
+
+ // Constructor ---------------------------------------------------
+
+ public VFSDeploymentScannerImpl()
+ {
+ // empty
+ }
+
+ // Attributes ----------------------------------------------------
+
+ public void setMainDeployer(MainDeployer deployer)
+ {
+ this.mainDeployer = deployer;
+ }
+
+ public VirtualFileFilter getFilterInstance()
+ {
+ return filter;
+ }
+ public void setFilterInstance(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ /**
+ * @return Returns the scanExecutor.
+ */
+ public ScheduledExecutorService getScanExecutor()
+ {
+ return this.scanExecutor;
+ }
+
+ /**
+ * @param scanExecutor The scanExecutor to set.
+ */
+ public void setScanExecutor(ScheduledExecutorService scanExecutor)
+ {
+ this.scanExecutor = scanExecutor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.deployment.scanner.VFSDeploymentScanner#getScanPeriod()
+ */
+ public long getScanPeriod()
+ {
+ return scanPeriod;
+ }
+ /* (non-Javadoc)
+ * @see org.jboss.deployment.scanner.VFSDeploymentScanner#setScanPeriod(long)
+ */
+ public void setScanPeriod(long period)
+ {
+ this.scanPeriod = period;
+ }
+
+ /**
+ * Are deployment scans enabled.
+ *
+ * @return whether scan is enabled
+ */
+ public boolean isScanEnabled()
+ {
+ return activeScan != null;
+ }
+
+ public synchronized int getScanCount()
+ {
+ return scanCount;
+ }
+ public synchronized void resetScanCount()
+ {
+ this.scanCount = 0;
+ }
+
+ /**
+ * Enable/disable deployment scans.
+ * @param scanEnabled true to enable scans, false to disable.
+ */
+ public synchronized void setScanEnabled(boolean scanEnabled)
+ {
+ if( scanEnabled == true && activeScan == null )
+ {
+ activeScan = this.scanExecutor.scheduleWithFixedDelay(this, 0,
+ scanPeriod, TimeUnit.MILLISECONDS);
+ }
+ else if( scanEnabled == false && activeScan != null )
+ {
+ activeScan.cancel(true);
+ activeScan = null;
+ }
+ }
+
+ /**
+ * Set the urls to scan
+ *
+ * @param listspec the urls
+ * @throws URISyntaxException
+ * @throws IOException
+ */
+ public void setURIs(final String listspec) throws URISyntaxException, IOException
+ {
+ if (listspec == null)
+ {
+ this.uriList.clear();
+ return;
+ }
+ List<URI> list = new LinkedList<URI>();
+
+ StringTokenizer stok = new StringTokenizer(listspec, ",");
+ while (stok.hasMoreTokens())
+ {
+ String urispec = stok.nextToken().trim();
+
+ log.debug("Adding URI from spec: " + urispec);
+
+ URI uri = makeURI(urispec);
+
+ log.debug("URI: " + uri);
+
+ list.add(uri);
+ }
+ setURIList(list);
+ }
+
+ /**
+ * Set uris to scan
+ *
+ * @param list the urls to scan
+ * @throws IOException
+ */
+ public void setURIList(final List<URI> list) throws IOException
+ {
+ if (list == null)
+ {
+ return;
+ }
+
+ // start out with a fresh list
+ uriList.clear();
+
+ for(int n = 0; n < list.size(); n ++)
+ {
+ URI uri = list.get(n);
+ if (uri == null)
+ {
+ throw new IllegalArgumentException("list element["+n+"] is null");
+ }
+ addURI(uri);
+ }
+ log.debug("URI list: " + uriList);
+ }
+
+ public List<URI> getURIList()
+ {
+ return new ArrayList<URI>(uriList);
+ }
+
+ public void setRecursiveSearch(boolean recurse)
+ {
+ doRecursiveSearch = recurse;
+ }
+
+ public boolean getRecursiveSearch()
+ {
+ return doRecursiveSearch;
+ }
+
+ // Operations ----------------------------------------------------
+
+ public void addURI(final URI uri) throws IOException
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("uri argument cannot be null");
+ }
+ if( uriList.add(uri) == true )
+ {
+ log.debug("Added URI: " + uri);
+ VirtualFile vf = VFS.getRoot(uri);
+ vdfList.add(vf);
+ }
+ }
+
+ public void removeURI(final URI uri)
+ throws IOException
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("uri argument cannot be null");
+ }
+ VirtualFile vf = VFS.getRoot(uri);
+ vdfList.remove(vf);
+ boolean success = uriList.remove(uri);
+
+ if (success)
+ {
+ log.debug("Removed URI: " + uri);
+ }
+ }
+
+ public boolean hasURI(final URI uri)
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("uri argument cannot be null");
+ }
+ return uriList.contains(uri);
+ }
+
+ public void start() throws Exception
+ {
+ // synchronize uriList and vdfList because only at this point
+ // setVirtualFileFactory() injection has been performed
+ vdfList.clear();
+ for (URI uri : uriList)
+ {
+ VirtualFile vf = VFS.getRoot(uri);
+ vdfList.add(vf);
+ }
+
+ // Default to a single thread executor
+ if( scanExecutor == null )
+ {
+ scanExecutor = Executors.newSingleThreadScheduledExecutor(
+ new ThreadFactory()
+ {
+ public Thread newThread(Runnable r)
+ {
+ return new Thread(r, "VFSDeploymentScanner");
+ }
+ }
+ );
+ }
+ activeScan = scanExecutor.scheduleWithFixedDelay(this, 0,
+ scanPeriod, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * Executes scan
+ *
+ */
+ public void run()
+ {
+ try
+ {
+ scan();
+ }
+ catch(Throwable e)
+ {
+ log.warn("Scan failed", e);
+ }
+ finally
+ {
+ incScanCount();
+ }
+ }
+
+ public void stop()
+ {
+ if( activeScan != null )
+ {
+ activeScan.cancel(true);
+ activeScan = null;
+ }
+ }
+
+ public synchronized void scan() throws Exception
+ {
+ if (vdfList == null)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ boolean trace = log.isTraceEnabled();
+
+ // Scan for deployments
+ log.debug("Begin deployment scan");
+
+ // VirtualFiles to deploy
+ List<VirtualFile> toDeployList = new LinkedList<VirtualFile>();
+ synchronized (vdfList)
+ {
+ for (VirtualFile vf : vdfList)
+ {
+ if( trace )
+ log.trace("Checking file: "+vf);
+ if (vf.isLeaf())
+ {
+ // treat this as a deployable unit
+ toDeployList.add(vf);
+ }
+ else
+ {
+ // process (possibly recursively) the dir
+ addDeployments(toDeployList, vf);
+ }
+ }
+ }
+
+ if (trace)
+ {
+ log.trace("toDeployList: "+toDeployList);
+ }
+ LinkedList<VirtualFile> toRemoveList = new LinkedList<VirtualFile>();
+ LinkedList<VirtualFile> toCheckForUpdateList = new LinkedList<VirtualFile>();
+
+ synchronized (deployedMap)
+ {
+ // remove previously deployed URLs no longer needed
+ Iterator<VirtualFile> iter = deployedMap.keySet().iterator();
+ while( iter.hasNext() )
+ {
+ VirtualFile vf = iter.next();
+ if (toDeployList.contains(vf))
+ {
+ toCheckForUpdateList.add(vf);
+ }
+ else
+ {
+ toRemoveList.add(vf);
+ }
+ }
+ }
+
+ // ********
+ // Undeploy
+ // ********
+
+ for (VirtualFile vf : toRemoveList)
+ {
+ undeploy(vf);
+ }
+
+ // ********
+ // Redeploy
+ // ********
+
+ // compute the DeployedURL list to update
+ ArrayList<VirtualFile> toUpdateList = new ArrayList<VirtualFile>(toCheckForUpdateList.size());
+ for (VirtualFile vf : toUpdateList)
+ {
+ DeploymentInfo info = deployedMap.get(vf);
+ long modified = vf.getLastModified();
+ Long prevLastDeployed = info.lastModified;;
+ if (prevLastDeployed.compareTo(modified) < 0)
+ {
+ info.lastModified = modified;
+ if (trace)
+ {
+ log.trace("Re-deploying " + vf);
+ }
+ toUpdateList.add(vf);
+ }
+ }
+
+ // sort to update list
+ //Collections.sort(toUpdateList, sorter);
+
+ // Undeploy in order
+ for (int i = toUpdateList.size() - 1; i >= 0; i--)
+ {
+ VirtualFile vf = toUpdateList.get(i);
+ undeploy(vf);
+ }
+
+ // Deploy in order
+ for (int i = 0; i < toUpdateList.size(); i++)
+ {
+ VirtualFile vf = toUpdateList.get(i);
+ deploy(vf);
+ }
+
+ // ******
+ // Deploy
+ // ******
+
+ //Collections.sort(toDeployList, sorter);
+ for (Iterator i = toDeployList.iterator(); i.hasNext();)
+ {
+ VirtualFile vf = (VirtualFile)i.next();
+
+ // if vf is not deployed already, deploy it
+ if (!deployedMap.containsKey(vf))
+ {
+ deploy(vf);
+ }
+
+ // vf must have been deployed by now, so remove it from list
+ i.remove();
+
+ }
+ log.debug("End deployment scan");
+ }
+
+ /**
+ * Inc the scanCount and to a notifyAll.
+ *
+ */
+ protected synchronized void incScanCount()
+ {
+ scanCount ++;
+ notifyAll();
+ }
+
+ // Private -------------------------------------------------------
+
+ /**
+ * A helper to make a URI from a full/partial urispec
+ */
+ private URI makeURI(String urispec) throws URISyntaxException
+ {
+ // First replace URI with appropriate properties
+ urispec = StringPropertyReplacer.replaceProperties(urispec);
+ return serverHomeURI.resolve(urispec);
+ }
+
+ /**
+ * A helper to find all deployments under a directory vf
+ * and add them to the supplied list.
+ *
+ * We may recurse.
+ */
+ private void addDeployments(List<VirtualFile> list, VirtualFile root)
+ throws IOException
+ {
+ List<VirtualFile> components = root.getChildren();
+
+ for (VirtualFile vf : components)
+ {
+ if (vf.isLeaf())
+ {
+ // the first arg in filter.accept is not used!
+ if (filter == null || filter.accepts(vf))
+ {
+ list.add(vf);
+ }
+ }
+ else
+ {
+ if (vf.getName().indexOf('.') == -1 && this.doRecursiveSearch)
+ {
+ // recurse if not '.' in name and recursive search is enabled
+ addDeployments(list, vf);
+ }
+ else
+ {
+ list.add(vf);
+ }
+ }
+ }
+ }
+
+ /**
+ * A helper to deploy the given vf using the deployer.
+ */
+ private void deploy(final VirtualFile vf)
+ {
+ // If the deployer is null simply ignore the request
+ log.debug("Deploying: " + vf);
+ Deployment deployment = deploymentFactory.createVFSDeployment(vf);
+ try
+ {
+ mainDeployer.addDeployment(deployment);
+ mainDeployer.process();
+ }
+ catch (Exception e)
+ {
+ log.warn("Failed to deploy: " + vf, e);
+ // TODO: somehow need to ignore bad deployments to avoid repeated errors
+ return;
+ }
+
+ /* TODO: this differs from the previous behavior. We would need a type to metainf location
+ if we want to watch the same file as jboss4. But since not all files have a deployment
+ descriptor, we need to be able to watch the deployment root anyway.
+ */
+ try
+ {
+ DeploymentInfo info = new DeploymentInfo(deployment, vf.getLastModified());
+ if (!deployedMap.containsKey(vf))
+ {
+ deployedMap.put(vf, info);
+ }
+ }
+ catch(IOException e)
+ {
+ log.warn("Failed to obtain lastModified for: "+vf, e);
+ }
+ }
+
+ /**
+ * A helper to undeploy the given vf using the deployer.
+ */
+ private void undeploy(final VirtualFile vf)
+ {
+ try
+ {
+ log.debug("Undeploying: " + vf);
+ DeploymentInfo info = deployedMap.remove(vf);
+ mainDeployer.removeDeployment(info.deployment);
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to undeploy: " + vf, e);
+ }
+ }
+
+ /**
+ * DeploymentInfo.
+ */
+ private class DeploymentInfo
+ {
+ /** The deployment */
+ Deployment deployment;
+
+ /** The last modified time */
+ long lastModified;
+
+ /**
+ * Create a new DeploymentInfo.
+ *
+ * @param deployment the deployment
+ * @param lastModified the last modified
+ */
+ public DeploymentInfo(Deployment deployment, long lastModified)
+ {
+ if (deployment == null)
+ throw new IllegalArgumentException("Null deployment");
+ this.deployment = deployment;
+ this.lastModified = lastModified;
+ }
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,71 +1,71 @@
-/*
- * 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.deployers.spi.management;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A DeploymentTemplate is a template for creating a DeploymentContext given
- * a set of ManagedProperty representing the template properties
- * to set in the resulting deployment.
- *
- * TODO: this needs to be fleshed out in terms of the various pieces, raw deployment
- * files, ManagedObjects, etc.
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface DeploymentTemplate
-{
- /**
- * Get the exportable representation of the properties that the
- * template supports.
- * @return the external representation of the template properties.
- */
- public DeploymentTemplateInfo getInfo();
-
- /**
- * Create a deployment virtual that can be added to a profile.
- *
- * @param root - the parent directory where the deployment can be created.
- * @param deploymentBaseName - a base name (without any suffix) to use for
- * any deployment files.
- * @param values - the template ManagedProperty values.
- * @return the virtual file for the template deployment.
- * @throws Exception - thrown on any failure to create the deployment
- */
- public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName,
- DeploymentTemplateInfo values)
- throws Exception;
-
- /**
- * Update the DeploymentContext with any attachments needed by the
- * ManagedProperty instance found in values.
- * @param ctx - the DeploymentContext created from the applyTemplate result.
- * @param values - the template ManagedProperty values.
- * @throws Exception
- */
- public void updateTemplateDeployment(VFSDeployment ctx,
- DeploymentTemplateInfo values)
- throws Exception;
-}
+/*
+ * 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.deployers.spi.management;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A DeploymentTemplate is a template for creating a DeploymentContext given
+ * a set of ManagedProperty representing the template properties
+ * to set in the resulting deployment.
+ *
+ * TODO: this needs to be fleshed out in terms of the various pieces, raw deployment
+ * files, ManagedObjects, etc.
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentTemplate
+{
+ /**
+ * Get the exportable representation of the properties that the
+ * template supports.
+ * @return the external representation of the template properties.
+ */
+ public DeploymentTemplateInfo getInfo();
+
+ /**
+ * Create a deployment virtual that can be added to a profile.
+ *
+ * @param root - the parent directory where the deployment can be created.
+ * @param deploymentBaseName - a base name (without any suffix) to use for
+ * any deployment files.
+ * @param values - the template ManagedProperty values.
+ * @return the virtual file for the template deployment.
+ * @throws Exception - thrown on any failure to create the deployment
+ */
+ public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName,
+ DeploymentTemplateInfo values)
+ throws Exception;
+
+ /**
+ * Update the DeploymentContext with any attachments needed by the
+ * ManagedProperty instance found in values.
+ * @param ctx - the DeploymentContext created from the applyTemplate result.
+ * @param values - the template ManagedProperty values.
+ * @throws Exception
+ */
+ public void updateTemplateDeployment(VFSDeployment ctx,
+ DeploymentTemplateInfo values)
+ throws Exception;
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/KnownDeploymentTypes.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/KnownDeploymentTypes.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/KnownDeploymentTypes.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,67 +1,67 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management;
-
-import org.jboss.managed.api.ManagedDeployment;
-
-/**
- * Enum for the known deployment types.
- * @see {@linkplain ManagedDeployment#getTypes()}
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public enum KnownDeploymentTypes
-{
- JavaEEApplication("ear"),
- JavaEEClientApplication("car"),
- JavaEEEnterpriseBeans2x("ejb2x"),
- JavaEEEnterpriseBeans3x("ejb3x"),
- JavaEEWebApplication("war"),
- JavaEEResourceAdaptor("rar"),
- JavaEEPersistenceUnit("par"),
- JBossServices("sar"),
- MCBeans("beans"),
- OSGIBundle("bundle"),
- SpringApplication("spring"),
- Unknown("*")
- ;
-
- /** The simple type string, usually used as the deployment archive suffix */
- private final String type;
-
- private KnownDeploymentTypes(String type)
- {
- this.type = type;
- }
-
- /**
- * Get the simple deployment type string. This is usually used as the
- * associated deployment archive suffix.
- *
- * @return the simple deployment type string.
- */
- public String getType()
- {
- return type;
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management;
+
+import org.jboss.managed.api.ManagedDeployment;
+
+/**
+ * Enum for the known deployment types.
+ * @see {@linkplain ManagedDeployment#getTypes()}
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public enum KnownDeploymentTypes
+{
+ JavaEEApplication("ear"),
+ JavaEEClientApplication("car"),
+ JavaEEEnterpriseBeans2x("ejb2x"),
+ JavaEEEnterpriseBeans3x("ejb3x"),
+ JavaEEWebApplication("war"),
+ JavaEEResourceAdaptor("rar"),
+ JavaEEPersistenceUnit("par"),
+ JBossServices("sar"),
+ MCBeans("beans"),
+ OSGIBundle("bundle"),
+ SpringApplication("spring"),
+ Unknown("*")
+ ;
+
+ /** The simple type string, usually used as the deployment archive suffix */
+ private final String type;
+
+ private KnownDeploymentTypes(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Get the simple deployment type string. This is usually used as the
+ * associated deployment archive suffix.
+ *
+ * @return the simple deployment type string.
+ */
+ public String getType()
+ {
+ return type;
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/KnownDeploymentTypes.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,177 +1,177 @@
-/*
- * 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.deployers.spi.management;
-
-import java.net.URL;
-import java.util.Set;
-
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.ProfileKey;
-
-/**
- * The management view plugin spi for querying profiles for the
- * deployemnt management object interface roots.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface ManagementView
-{
- /**
- * Load and associate the given profile with the ManagementView
- * for future operations.
- *
- * @param key - the profile to load
- * @throws NoSuchProfileException
- */
- public void loadProfile(ProfileKey key)
- throws Exception;
-
- /**
- * Get the names of the deployment in the profile.
- *
- * @return the names
- */
- public Set<String> getDeploymentNames();
-
- /**
- * Get the names of the deployment in the profile that have the
- * given deployment type.
- * @param type - the deployment type
- * @return the names
- */
- public Set<String> getDeploymentNamesForType(String type);
-
- /**
- * Search for a deployment matching the regex expression.
- * @param regex - the regex to query deployment name
- * @return the deployment name.
- * @throws NoSuchDeploymentException if no matches are found
- */
- public Set<String> getMatchingDeploymentName(String regex)
- throws NoSuchDeploymentException;
-
- /**
- * Get a deployment
- *
- * @param name the name
- * @param phase the phase
- * @return the deployment
- * @throws NoSuchDeploymentException if no matches are found
- * @throws Exception for any error
- */
- public ManagedDeployment getDeployment(String name, DeploymentPhase phase)
- throws NoSuchDeploymentException, Exception;
-
- /**
- * Get the deployments of a type.
- * @param type - the deployment or module type.
- * @return the possibly empty set of deployment with the given type.
- * @throws Exception
- */
- public Set<ManagedDeployment> getDeploymentsForType(String type)
- throws Exception;
-
- /**
- * Get the components of a type. The
- * @param type - the component type.
- * @return the possibly empty set of components with the given type.
- * @throws Exception
- */
- public Set<ManagedComponent> getComponentsForType(ComponentType type)
- throws Exception;
-
- /**
- * Obtain the ManagedComponent for the given name/type
- * @return the possibly null ManagedComponent
- * @throws Exception
- */
- public ManagedComponent getComponent(String name, ComponentType type)
- throws Exception;
-
- /**
- * Update the given component. This takes the component ManagedDeployment,
- * obtains the ManagedObject set for the underlying deployment, and applies
- * the component ManagedProperty set to matching the deployment ManagedObject
- * properties.
- *
- * @param comp
- * @throws Exception
- */
- public void updateComponent(ManagedComponent comp)
- throws Exception;
-
- /**
- * Get the registered DeploymentTemplate names.
- *
- * TODO: probably needs a Map<String, DeploymentType> notion
- * @return the template names
- */
- public Set<String> getTemplateNames();
-
- /**
- * Get a deployment template.
- *
- * @param name - the deployment name to identify the template to retrieve
- * @return the named DeploymentTemplate
- * @throws NoSuchDeploymentException - if there is no such template
- */
- public DeploymentTemplateInfo getTemplate(String name)
- throws NoSuchDeploymentException;
-
- /**
- *
- * @param phase
- * @param deploymentBaseName
- * @param info
- * @throws Exception
- */
- public void applyTemplate(DeploymentPhase phase,
- String deploymentBaseName, DeploymentTemplateInfo info)
- throws Exception;
-
- /**
- * Remove a deployment
- *
- * @param deploymentName the deployment name
- * @param phase the phase
- * @throws NoSuchProfileException
- * @throws NoSuchDeploymentException
- * @throws Exception for any error
- */
- public void removeDeployment(String deploymentName, DeploymentPhase phase)
- throws NoSuchDeploymentException, Exception;
-
- /**
- * Process the changes made to the profile.
- *
- * @throws Exception
- */
- public void process() throws Exception;
-}
+/*
+ * 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.deployers.spi.management;
+
+import java.net.URL;
+import java.util.Set;
+
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * The management view plugin spi for querying profiles for the
+ * deployemnt management object interface roots.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ManagementView
+{
+ /**
+ * Load and associate the given profile with the ManagementView
+ * for future operations.
+ *
+ * @param key - the profile to load
+ * @throws NoSuchProfileException
+ */
+ public void loadProfile(ProfileKey key)
+ throws Exception;
+
+ /**
+ * Get the names of the deployment in the profile.
+ *
+ * @return the names
+ */
+ public Set<String> getDeploymentNames();
+
+ /**
+ * Get the names of the deployment in the profile that have the
+ * given deployment type.
+ * @param type - the deployment type
+ * @return the names
+ */
+ public Set<String> getDeploymentNamesForType(String type);
+
+ /**
+ * Search for a deployment matching the regex expression.
+ * @param regex - the regex to query deployment name
+ * @return the deployment name.
+ * @throws NoSuchDeploymentException if no matches are found
+ */
+ public Set<String> getMatchingDeploymentName(String regex)
+ throws NoSuchDeploymentException;
+
+ /**
+ * Get a deployment
+ *
+ * @param name the name
+ * @param phase the phase
+ * @return the deployment
+ * @throws NoSuchDeploymentException if no matches are found
+ * @throws Exception for any error
+ */
+ public ManagedDeployment getDeployment(String name, DeploymentPhase phase)
+ throws NoSuchDeploymentException, Exception;
+
+ /**
+ * Get the deployments of a type.
+ * @param type - the deployment or module type.
+ * @return the possibly empty set of deployment with the given type.
+ * @throws Exception
+ */
+ public Set<ManagedDeployment> getDeploymentsForType(String type)
+ throws Exception;
+
+ /**
+ * Get the components of a type. The
+ * @param type - the component type.
+ * @return the possibly empty set of components with the given type.
+ * @throws Exception
+ */
+ public Set<ManagedComponent> getComponentsForType(ComponentType type)
+ throws Exception;
+
+ /**
+ * Obtain the ManagedComponent for the given name/type
+ * @return the possibly null ManagedComponent
+ * @throws Exception
+ */
+ public ManagedComponent getComponent(String name, ComponentType type)
+ throws Exception;
+
+ /**
+ * Update the given component. This takes the component ManagedDeployment,
+ * obtains the ManagedObject set for the underlying deployment, and applies
+ * the component ManagedProperty set to matching the deployment ManagedObject
+ * properties.
+ *
+ * @param comp
+ * @throws Exception
+ */
+ public void updateComponent(ManagedComponent comp)
+ throws Exception;
+
+ /**
+ * Get the registered DeploymentTemplate names.
+ *
+ * TODO: probably needs a Map<String, DeploymentType> notion
+ * @return the template names
+ */
+ public Set<String> getTemplateNames();
+
+ /**
+ * Get a deployment template.
+ *
+ * @param name - the deployment name to identify the template to retrieve
+ * @return the named DeploymentTemplate
+ * @throws NoSuchDeploymentException - if there is no such template
+ */
+ public DeploymentTemplateInfo getTemplate(String name)
+ throws NoSuchDeploymentException;
+
+ /**
+ *
+ * @param phase
+ * @param deploymentBaseName
+ * @param info
+ * @throws Exception
+ */
+ public void applyTemplate(DeploymentPhase phase,
+ String deploymentBaseName, DeploymentTemplateInfo info)
+ throws Exception;
+
+ /**
+ * Remove a deployment
+ *
+ * @param deploymentName the deployment name
+ * @param phase the phase
+ * @throws NoSuchProfileException
+ * @throws NoSuchDeploymentException
+ * @throws Exception for any error
+ */
+ public void removeDeployment(String deploymentName, DeploymentPhase phase)
+ throws NoSuchDeploymentException, Exception;
+
+ /**
+ * Process the changes made to the profile.
+ *
+ * @throws Exception
+ */
+ public void process() throws Exception;
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,63 +1,63 @@
-/*
- * 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.deployers.spi.management;
-
-import org.jboss.metatype.api.values.MetaValue;
-
-/**
- * Dispatches ManagedOperation invocation to runtime component
- * associated with attachment.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- * @version $Revision$
- */
-public interface RuntimeComponentDispatcher
-{
- /**
- * Get value.
- *
- * @param componentName the runtime component name
- * @param propertyName the property name
- * @return the return meta value
- */
- MetaValue get(Object componentName, String propertyName);
-
- /**
- * Set the value.
- *
- * @param componentName the runtime component name
- * @param propertyName the property name
- * @param value the meta value
- */
- void set(Object componentName, String propertyName, MetaValue value);
-
- /**
- * Dispatch ManagedOperation invocation
- * with param parameters to coresponding attachment.
- *
- * @param componentName the runtime component name
- * @param methodName the methodName
- * @param param the parameters
- * @return runtime component's return value
- */
- Object invoke(Object componentName, String methodName, MetaValue... param);
-}
+/*
+ * 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.deployers.spi.management;
+
+import org.jboss.metatype.api.values.MetaValue;
+
+/**
+ * Dispatches ManagedOperation invocation to runtime component
+ * associated with attachment.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision$
+ */
+public interface RuntimeComponentDispatcher
+{
+ /**
+ * Get value.
+ *
+ * @param componentName the runtime component name
+ * @param propertyName the property name
+ * @return the return meta value
+ */
+ MetaValue get(Object componentName, String propertyName);
+
+ /**
+ * Set the value.
+ *
+ * @param componentName the runtime component name
+ * @param propertyName the property name
+ * @param value the meta value
+ */
+ void set(Object componentName, String propertyName, MetaValue value);
+
+ /**
+ * Dispatch ManagedOperation invocation
+ * with param parameters to coresponding attachment.
+ *
+ * @param componentName the runtime component name
+ * @param methodName the methodName
+ * @param param the parameters
+ * @return runtime component's return value
+ */
+ Object invoke(Object componentName, String methodName, MetaValue... param);
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentID.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentID.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentID.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,82 +1,82 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-import java.net.URL;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * A representation of a top-level deployment id.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface DeploymentID
-{
- /**
- * Get the names of the deployments
- *
- * @return the deployment name
- */
- String[] getNames();
- /**
- * Get the unique names of the deployments in the repository. Some DeploymentManager
- * operations like distribute produce an alternate unique name that differs
- * from the input name. In this case this method will provide the unique
- * names for the input names. Otherwise this returns the same value as
- * getNames.
- * @return the unique names of the deployments in the repository
- */
- String[] getRepositoryNames();
- /**
- * Set the unique names of the deployments in the repository.
- * @see #getRepositoryNames()
- * @param names - the unique names of the deployments in the repository
- */
- public void setRepositoryNames(String[] names);
-
- /**
- * Get the phase the deployment is associated with
- * @return
- */
- DeploymentPhase getPhase();
-
- /**
- * An optional content URL used for distribute/redeploy operations.
- * @return
- */
- public URL getContentURL();
-
- /**
- * Do we copy content or jut ref it.
- * @return
- */
- boolean isCopyContent();
-
- /**
- * Get a description of the deployment
- *
- * @return the identifier
- */
- String getDescription();
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+import java.net.URL;
+
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+
+/**
+ * A representation of a top-level deployment id.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentID
+{
+ /**
+ * Get the names of the deployments
+ *
+ * @return the deployment name
+ */
+ String[] getNames();
+ /**
+ * Get the unique names of the deployments in the repository. Some DeploymentManager
+ * operations like distribute produce an alternate unique name that differs
+ * from the input name. In this case this method will provide the unique
+ * names for the input names. Otherwise this returns the same value as
+ * getNames.
+ * @return the unique names of the deployments in the repository
+ */
+ String[] getRepositoryNames();
+ /**
+ * Set the unique names of the deployments in the repository.
+ * @see #getRepositoryNames()
+ * @param names - the unique names of the deployments in the repository
+ */
+ public void setRepositoryNames(String[] names);
+
+ /**
+ * Get the phase the deployment is associated with
+ * @return
+ */
+ DeploymentPhase getPhase();
+
+ /**
+ * An optional content URL used for distribute/redeploy operations.
+ * @return
+ */
+ public URL getContentURL();
+
+ /**
+ * Do we copy content or jut ref it.
+ * @return
+ */
+ boolean isCopyContent();
+
+ /**
+ * Get a description of the deployment
+ *
+ * @return the identifier
+ */
+ String getDescription();
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentID.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,155 +1,155 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-import java.net.URL;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.ProfileKey;
-
-/**
- * An interface for uploading and controlling deployments in a profile.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface DeploymentManager
-{
- /**
- * Load and associate the given profile with the DeploymentManager
- * for future operations.
- *
- * @param key - the profile to load
- * @param allowHotDeployments - Can be used to suspend hot deployment
- * processing while working against a live server to avoid conflicts.
- * @throws Exception for any error
- */
- public void loadProfile(ProfileKey key, boolean allowHotDeployments) throws Exception;
- /**
- * Release a profile. This frees any resources and resets the hot deployment
- * processing.
- *
- * @param key - the profile to load
- * @param allowHotDeployments - Can be used to suspend hot deployment
- * processing while working against a live server to avoid conflicts.
- * @throws Exception
- */
- public void releaseProfile(ProfileKey key, boolean allowHotDeployments) throws Exception;
-
- /**
- * Add raw deployment content to the profile.
- *
- * @param name phase unique name
- * @param phase the phase this deployment applies to
- * @param contentURL - URL for obtaining the deployment archive
- * @return DeploymentProgress progress object for the deployment
- */
- @Deprecated
- public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL)
- throws Exception;
-
- /**
- * Add raw deployment content to the profile.
- *
- * @param name phase unique name
- * @param phase the phase this deployment applies to
- * @param contentURL - URL for obtaining the deployment archive
- * @param copyContent should we copy content or just reference it
- * @return DeploymentProgress progress object for the deployment
- */
- public DeploymentProgress distribute(String name, DeploymentPhase phase,
- URL contentURL, boolean copyContent)
- throws Exception;
-
- /**
- * Map from the external name passed to distribute to the uploaded
- * deployment repository name.
- *
- * @param names - the list of external deployment names
- * @param phase the deployment phase
- * @return the mapped list of unique names in the deployment repository.
- * @throws Exception for any error
- */
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws Exception;
-
- /**
- * Is redeploy supported.
- *
- * @return true if redeploy suported
- */
- public boolean isRedeploySupported();
-
- /**
- * Do redeploy.
- *
- * @param name the deployment to redeploy
- * @param phase the deployment phase
- * @param contentURL deployment's url
- * @return a DeploymentProgress used to run and track the redeploy progress.
- */
- public DeploymentProgress redeploy(String name, DeploymentPhase phase, URL contentURL)
- throws Exception;
-
- /**
- * Prepare a set of deployments through their dependency analysis phase.
- *
- * @param phase the deployment phase
- * @param names the unique names of the deployments within the phase to prepare
- * @return a DeploymentProgress used to run and track the prepare progress.
- * @throws Exception for any error
- */
- public DeploymentProgress prepare(DeploymentPhase phase, String... names)
- throws Exception;
-
- /**
- * Start a previously distributed deployment.
- *
- * @param phase the deployment phase
- * @param names the unique names of the deployments within the phase to start
- * @return a DeploymentProgress used to run and track the start progress.
- * @throws Exception for any error
- */
- public DeploymentProgress start(DeploymentPhase phase, String... names)
- throws Exception;
-
- /**
- * Stop a previously started deployment.
- *
- * @param phase the deployment phase
- * @param names the unique names of the deployments within the phase to stop
- * @return a DeploymentProgress used to run and track the stop progress.
- * @throws Exception for any error
- */
- public DeploymentProgress stop(DeploymentPhase phase, String... names)
- throws Exception;
-
- /**
- * Undeploy a previously distributed deployment.
- *
- * @param phase the deployment phase
- * @param names the unique names of the deployments within the phase to prepare
- * @return a DeploymentProgress used to run and track the prepare progress.
- * @throws Exception for any error
- */
- public DeploymentProgress undeploy(DeploymentPhase phase, String... names)
- throws Exception;
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+import java.net.URL;
+
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * An interface for uploading and controlling deployments in a profile.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentManager
+{
+ /**
+ * Load and associate the given profile with the DeploymentManager
+ * for future operations.
+ *
+ * @param key - the profile to load
+ * @param allowHotDeployments - Can be used to suspend hot deployment
+ * processing while working against a live server to avoid conflicts.
+ * @throws Exception for any error
+ */
+ public void loadProfile(ProfileKey key, boolean allowHotDeployments) throws Exception;
+ /**
+ * Release a profile. This frees any resources and resets the hot deployment
+ * processing.
+ *
+ * @param key - the profile to load
+ * @param allowHotDeployments - Can be used to suspend hot deployment
+ * processing while working against a live server to avoid conflicts.
+ * @throws Exception
+ */
+ public void releaseProfile(ProfileKey key, boolean allowHotDeployments) throws Exception;
+
+ /**
+ * Add raw deployment content to the profile.
+ *
+ * @param name phase unique name
+ * @param phase the phase this deployment applies to
+ * @param contentURL - URL for obtaining the deployment archive
+ * @return DeploymentProgress progress object for the deployment
+ */
+ @Deprecated
+ public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL)
+ throws Exception;
+
+ /**
+ * Add raw deployment content to the profile.
+ *
+ * @param name phase unique name
+ * @param phase the phase this deployment applies to
+ * @param contentURL - URL for obtaining the deployment archive
+ * @param copyContent should we copy content or just reference it
+ * @return DeploymentProgress progress object for the deployment
+ */
+ public DeploymentProgress distribute(String name, DeploymentPhase phase,
+ URL contentURL, boolean copyContent)
+ throws Exception;
+
+ /**
+ * Map from the external name passed to distribute to the uploaded
+ * deployment repository name.
+ *
+ * @param names - the list of external deployment names
+ * @param phase the deployment phase
+ * @return the mapped list of unique names in the deployment repository.
+ * @throws Exception for any error
+ */
+ public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws Exception;
+
+ /**
+ * Is redeploy supported.
+ *
+ * @return true if redeploy suported
+ */
+ public boolean isRedeploySupported();
+
+ /**
+ * Do redeploy.
+ *
+ * @param name the deployment to redeploy
+ * @param phase the deployment phase
+ * @param contentURL deployment's url
+ * @return a DeploymentProgress used to run and track the redeploy progress.
+ */
+ public DeploymentProgress redeploy(String name, DeploymentPhase phase, URL contentURL)
+ throws Exception;
+
+ /**
+ * Prepare a set of deployments through their dependency analysis phase.
+ *
+ * @param phase the deployment phase
+ * @param names the unique names of the deployments within the phase to prepare
+ * @return a DeploymentProgress used to run and track the prepare progress.
+ * @throws Exception for any error
+ */
+ public DeploymentProgress prepare(DeploymentPhase phase, String... names)
+ throws Exception;
+
+ /**
+ * Start a previously distributed deployment.
+ *
+ * @param phase the deployment phase
+ * @param names the unique names of the deployments within the phase to start
+ * @return a DeploymentProgress used to run and track the start progress.
+ * @throws Exception for any error
+ */
+ public DeploymentProgress start(DeploymentPhase phase, String... names)
+ throws Exception;
+
+ /**
+ * Stop a previously started deployment.
+ *
+ * @param phase the deployment phase
+ * @param names the unique names of the deployments within the phase to stop
+ * @return a DeploymentProgress used to run and track the stop progress.
+ * @throws Exception for any error
+ */
+ public DeploymentProgress stop(DeploymentPhase phase, String... names)
+ throws Exception;
+
+ /**
+ * Undeploy a previously distributed deployment.
+ *
+ * @param phase the deployment phase
+ * @param names the unique names of the deployments within the phase to prepare
+ * @return a DeploymentProgress used to run and track the prepare progress.
+ * @throws Exception for any error
+ */
+ public DeploymentProgress undeploy(DeploymentPhase phase, String... names)
+ throws Exception;
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,80 +1,80 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-import java.util.List;
-
-/**
- * An interface for tracking the progress of a deployment upload to a
- * profile via the profile service ManagementView spi.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface DeploymentProgress
-{
- /**
- * Retrieve the status of the deployment
- *
- * @return the status
- */
- DeploymentStatus getDeploymentStatus();
-
- /**
- * Get the identifier for the deployment the progress applies to
- * @return
- */
- DeploymentID getDeploymentID();
-
- /**
- * Retrieve the list of targets the deployment is distributed to
- *
- * @return the deployment targets
- */
- List<DeploymentTarget> getDeploymentTargets();
-
- /**
- * Begins the deployment command
- */
- void run();
-
- /**
- * Cancels the deployment
- *
- */
- void cancel();
-
- /**
- * Add a progress listener
- *
- * @param listener the listener
- */
- void addProgressListener(ProgressListener listener);
-
- /**
- * Remove a progress listener
- *
- * @param listener the listener
- */
- void removeProgressListener(ProgressListener listener);
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+import java.util.List;
+
+/**
+ * An interface for tracking the progress of a deployment upload to a
+ * profile via the profile service ManagementView spi.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentProgress
+{
+ /**
+ * Retrieve the status of the deployment
+ *
+ * @return the status
+ */
+ DeploymentStatus getDeploymentStatus();
+
+ /**
+ * Get the identifier for the deployment the progress applies to
+ * @return
+ */
+ DeploymentID getDeploymentID();
+
+ /**
+ * Retrieve the list of targets the deployment is distributed to
+ *
+ * @return the deployment targets
+ */
+ List<DeploymentTarget> getDeploymentTargets();
+
+ /**
+ * Begins the deployment command
+ */
+ void run();
+
+ /**
+ * Cancels the deployment
+ *
+ */
+ void cancel();
+
+ /**
+ * Add a progress listener
+ *
+ * @param listener the listener
+ */
+ void addProgressListener(ProgressListener listener);
+
+ /**
+ * Remove a progress listener
+ *
+ * @param listener the listener
+ */
+ void removeProgressListener(ProgressListener listener);
+
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,96 +1,96 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-
-/**
- * A deployment status interface used to provide information about a
- * DeploymentProgress event associated with a {@linkplain DeploymentManager}
- * command.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface DeploymentStatus
-{
- public enum StateType {
- UPLOADING, DEPLOYING, RUNNING, COMPLETED, FAILED, CANCELLED
- }
- public enum CommandType {
- DISTRIBUTE, PREPARE, START, STOP, UNDEPLOY, REDEPLOY
- }
-
- /**
- * Get the state of the deployment
- *
- * @return the state
- */
- StateType getState();
-
- /**
- * The deployment command
- *
- * @return the command
- */
- CommandType getCommand();
-
- /**
- * The target the status applies to
- * @return
- */
- DeploymentTarget getTarget();
-
- /**
- * Get the current status message
- *
- * @return the message
- */
- String getMessage();
-
- /**
- * Get the failure exception.
- * @return any failure exception associated with reaching the FAILED state.
- */
- Exception getFailure();
-
- /**
- * Is the deployment complete
- *
- * @return true when complete, false otherwise
- */
- boolean isCompleted();
-
- /**
- * Has the deployment failed
- *
- * @return true when failed, false otherwise
- */
- boolean isFailed();
-
- /**
- * Is the deployment in progress
- *
- * @return true when in progress, false otherwise
- */
- boolean isRunning();
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+
+/**
+ * A deployment status interface used to provide information about a
+ * DeploymentProgress event associated with a {@linkplain DeploymentManager}
+ * command.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentStatus
+{
+ public enum StateType {
+ UPLOADING, DEPLOYING, RUNNING, COMPLETED, FAILED, CANCELLED
+ }
+ public enum CommandType {
+ DISTRIBUTE, PREPARE, START, STOP, UNDEPLOY, REDEPLOY
+ }
+
+ /**
+ * Get the state of the deployment
+ *
+ * @return the state
+ */
+ StateType getState();
+
+ /**
+ * The deployment command
+ *
+ * @return the command
+ */
+ CommandType getCommand();
+
+ /**
+ * The target the status applies to
+ * @return
+ */
+ DeploymentTarget getTarget();
+
+ /**
+ * Get the current status message
+ *
+ * @return the message
+ */
+ String getMessage();
+
+ /**
+ * Get the failure exception.
+ * @return any failure exception associated with reaching the FAILED state.
+ */
+ Exception getFailure();
+
+ /**
+ * Is the deployment complete
+ *
+ * @return true when complete, false otherwise
+ */
+ boolean isCompleted();
+
+ /**
+ * Has the deployment failed
+ *
+ * @return true when failed, false otherwise
+ */
+ boolean isFailed();
+
+ /**
+ * Is the deployment in progress
+ *
+ * @return true when in progress, false otherwise
+ */
+ boolean isRunning();
+
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,64 +1,64 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * A target to which a deployment is uploaded.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface DeploymentTarget
-{
- /**
- * Get the target name
- *
- * @return the name
- */
- String getName();
-
-
- void distribute(DeploymentID deployment)
- throws Exception;
- String[] getRepositoryNames(String[] names, DeploymentPhase phase)
- throws Exception;
- void redeploy(DeploymentID deployment)
- throws Exception;
- void prepare(DeploymentID deployment)
- throws Exception;
- void start(DeploymentID deployment)
- throws Exception;
- void stop(DeploymentID deployment)
- throws Exception;
- void undeploy(DeploymentID deployment)
- throws Exception;
-
- /**
- * Get the target description
- *
- * @return the description
- */
- String getDescription();
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+
+/**
+ * A target to which a deployment is uploaded.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentTarget
+{
+ /**
+ * Get the target name
+ *
+ * @return the name
+ */
+ String getName();
+
+
+ void distribute(DeploymentID deployment)
+ throws Exception;
+ String[] getRepositoryNames(String[] names, DeploymentPhase phase)
+ throws Exception;
+ void redeploy(DeploymentID deployment)
+ throws Exception;
+ void prepare(DeploymentID deployment)
+ throws Exception;
+ void start(DeploymentID deployment)
+ throws Exception;
+ void stop(DeploymentID deployment)
+ throws Exception;
+ void undeploy(DeploymentID deployment)
+ throws Exception;
+
+ /**
+ * Get the target description
+ *
+ * @return the description
+ */
+ String getDescription();
+
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressEvent.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressEvent.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressEvent.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,65 +1,65 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-import java.io.Serializable;
-
-/**
- * A deployment progress event object.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class ProgressEvent
- implements Serializable
-{
- private static final long serialVersionUID = 1;
- private DeploymentID deploymentTargetID;
- private DeploymentStatus status;
-
- public ProgressEvent(DeploymentID deploymentTargetID, DeploymentStatus status)
- {
- super();
- this.deploymentTargetID = deploymentTargetID;
- this.status = status;
- }
-
- public DeploymentID getDeploymentName()
- {
- return deploymentTargetID;
- }
- public DeploymentStatus getStatus()
- {
- return status;
- }
-
- public String toString()
- {
- StringBuffer tmp = new StringBuffer("ProgressEvent(");
- tmp.append("deploymentTargetID=");
- tmp.append(this.deploymentTargetID);
- tmp.append("status=");
- tmp.append(this.status);
- tmp.append(")");
- return tmp.toString();
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+import java.io.Serializable;
+
+/**
+ * A deployment progress event object.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ProgressEvent
+ implements Serializable
+{
+ private static final long serialVersionUID = 1;
+ private DeploymentID deploymentTargetID;
+ private DeploymentStatus status;
+
+ public ProgressEvent(DeploymentID deploymentTargetID, DeploymentStatus status)
+ {
+ super();
+ this.deploymentTargetID = deploymentTargetID;
+ this.status = status;
+ }
+
+ public DeploymentID getDeploymentName()
+ {
+ return deploymentTargetID;
+ }
+ public DeploymentStatus getStatus()
+ {
+ return status;
+ }
+
+ public String toString()
+ {
+ StringBuffer tmp = new StringBuffer("ProgressEvent(");
+ tmp.append("deploymentTargetID=");
+ tmp.append(this.deploymentTargetID);
+ tmp.append("status=");
+ tmp.append(this.status);
+ tmp.append(")");
+ return tmp.toString();
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressEvent.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressListener.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressListener.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressListener.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,33 +1,33 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
-
-/**
- * A progress notification listener interface
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface ProgressListener
-{
- void progressEvent(ProgressEvent eventInfo);
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management.deploy;
+
+/**
+ * A progress notification listener interface
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface ProgressListener
+{
+ void progressEvent(ProgressEvent eventInfo);
+}
Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/ProgressListener.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,55 +1,55 @@
-/*
-* 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.profileservice.aop;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-
-/**
- * Placeholder
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class MainDeployerAspect
-{
- public String getName()
- {
- return this.getClass().getName();
- }
-
- public Object invoke(Invocation invocation) throws Throwable
- {
- MethodInvocation mi = (MethodInvocation) invocation;
- String methodName = mi.getMethod().getName();
- Object value = null;
- if( methodName.equals("process") )
- value = process(mi);
- else
- value = invocation.invokeNext();
- return value;
- }
- public Object process(Invocation invocation) throws Throwable
- {
- return invocation.invokeNext();
- }
-}
+/*
+* 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.profileservice.aop;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * Placeholder
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MainDeployerAspect
+{
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ MethodInvocation mi = (MethodInvocation) invocation;
+ String methodName = mi.getMethod().getName();
+ Object value = null;
+ if( methodName.equals("process") )
+ value = process(mi);
+ else
+ value = invocation.invokeNext();
+ return value;
+ }
+ public Object process(Invocation invocation) throws Throwable
+ {
+ return invocation.invokeNext();
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,42 +1,42 @@
-/*
-* 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.profileservice.aop;
-
-import org.jboss.aop.joinpoint.Invocation;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class PersistAspect
-{
- public String getName()
- {
- return this.getClass().getName();
- }
-
- public Object setValue(Invocation invocation) throws Throwable
- {
- return invocation.invokeNext();
- }
-}
+/*
+* 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.profileservice.aop;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class PersistAspect
+{
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public Object setValue(Invocation invocation) throws Throwable
+ {
+ return invocation.invokeNext();
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentContentFlags.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentContentFlags.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentContentFlags.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,40 +1,40 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.profileservice.spi;
-
-/**
- * States for DeploymentRepository content
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface DeploymentContentFlags
-{
- /** content that is not publicly visible in profile */
- public static final int DISABLED=1;
- /** content that is visible in profile */
- public static final int ENABLED=2;
- /** exists in profile, but is excluded from modified deployment checks. */
- public static final int LOCKED=4;
- /** Can be used to explicitly put a deployment into the modified list */
- public static final int MODIFIED=8;
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.profileservice.spi;
+
+/**
+ * States for DeploymentRepository content
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentContentFlags
+{
+ /** content that is not publicly visible in profile */
+ public static final int DISABLED=1;
+ /** content that is visible in profile */
+ public static final int ENABLED=2;
+ /** exists in profile, but is excluded from modified deployment checks. */
+ public static final int LOCKED=4;
+ /** Can be used to explicitly put a deployment into the modified list */
+ public static final int MODIFIED=8;
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentContentFlags.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,232 +1,232 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.profileservice.spi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * An interface for managing the contents of a Profile.
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision:$
- */
-public interface DeploymentRepository
-{
- public void create() throws Exception;
- public void load() throws Exception;
- public void remove() throws Exception;
- public long getLastModified();
-
- public URI getDeploymentURI(DeploymentPhase phase);
- public void setDeploymentURI(URI uri, DeploymentPhase phase);
-
- public Set<String> getDeploymentNames();
- public Set<String> getDeploymentNames(DeploymentPhase phase);
-
-
- /**
- * Upload raw deployment content to a profile repository. This does not make
- * the deployment avaialble to
- * @param vfsPath - the vfs path relative to the phase root
- * @param contentIS - the input stream for the deployment contents
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @throws IOException
- * @return the unique name of the deployment in the repository
- */
- public String addDeploymentContent(String vfsPath, InputStream contentIS, DeploymentPhase phase)
- throws IOException;
-
- /**
- * Get repository names.
- *
- * @param names the names
- * @param phase the deployment phase
- * @return full repository names
- * @throws IOException for any error
- */
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase)
- throws IOException;
-
- /**
- * Get the repository virtual file for the given deployment name
- * @param name - the unique virtual file URI name as returned by addDeploymentContent
- * @param phase - the phase of the deployment as it relates to when the deployment is loaded
- * @return the deployment content virtual file
- * @throws IOException for any error
- */
- public VirtualFile getDeploymentContent(String name, DeploymentPhase phase)
- throws IOException, URISyntaxException;
-
- /**
- * lock deployment content and exclude it from modified deployment checks.
- * @param vfsPath - the content vfs path relative to the deployment phase root
- * @param phase - the deployment phase
- * @return the deployment content flags, {@linkplain DeploymentContentFlags}
- */
- public int lockDeploymentContent(String vfsPath, DeploymentPhase phase);
- /**
- * Unlock a previously locked deployment content.
- * @param vfsPath - the content vfs path relative to the deployment phase root
- * @param phase - the deployment phase
- * @return the deployment content flags, {@linkplain DeploymentContentFlags}
- */
- public int unlockDeploymentContent(String vfsPath, DeploymentPhase phase);
-
- /**
- * Get the status flags for the deployment path
- * @param vfsPath - the content vfs path relative to the deployment phase root
- * @param phase - the deployment phase
- * @return the deployment content flags, {@linkplain DeploymentContentFlags}
- */
- public int getDeploymentContentFlags(String vfsPath, DeploymentPhase phase);
- /**
- * Set one or more flags for the deployment.
- * @see #clearDeploymentContentFlags(String, DeploymentPhase, int)
- *
- * @param vfsPath - the content vfs path relative to the deployment phase root
- * @param phase - the deployment phase
- * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
- */
- public int setDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flags);
- /**
- * Clear one or more flags for the deployment. This ands the compliment of
- * the flags argument into the existing content flags and returns the result.
- *
- * @param vfsPath - the content vfs path relative to the deployment phase root
- * @param phase - the deployment phase
- * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
- */
- public int clearDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flags);
- /**
- * Does a deployment content have the indicated flag.
- *
- * @param vfsPath - the content vfs path relative to the deployment phase root
- * @param phase - the deployment phase
- * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
- * @return true if the content flags contains the flag, false otherwise.
- */
- public boolean hasDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flag);
-
- /**
- * Acquire the repository write lock. This generally prevents content
- * uploads and {@link #getModifiedDeployments()} calls while the lock is
- * held.
- */
- public void acquireDeploymentContentLock();
- /**
- * Release the previously aquired repository write lock.
- */
- public void releaseDeploymentContentLock();
-
- /**
- * Add a deployment
- *
- * @param vfsPath the path
- * @param d the deployment
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @throws Exception for any error
- */
- public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
- throws Exception;
- /**
- * Update a deployments attachments. This persists the deployments
- * pre-determined attachments.
- *
- * @param vfsPath - the vfs path relative to the phase root for the deployment
- * @param phase - the deployment phase
- * @param attachments - the attachments that have been modified
- * @throws Exception
- */
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- Map<String, Object> attachments)
- throws Exception;
- /**
- * Get a named deployment.
- *
- * @param name - the deployment name
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @return the named bootstrap
- * @throws NoSuchDeploymentException - if there is no such bootstrap
- * @throws IOException
- * @throws Exception for any error
- */
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws NoSuchDeploymentException, Exception;
-
- /**
- * Remove a deployment
- *
- * @param vfsPath - the vfs path
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @return the removed deployment
- * @throws Exception for any error
- */
- public VFSDeployment removeDeployment(String vfsPath, DeploymentPhase phase)
- throws Exception;
-
- /**
- * Get all deployments for the given phase defined in this profile
- *
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @return the bootstrap instances in this profile.
- * @throws Exception for any error
- */
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- throws Exception;
- /**
- * Get all deployments defined in this profile
- *
- * @return the deployment instances in this profile.
- * @throws Exception for any error
- */
- public Collection<VFSDeployment> getDeployments()
- throws Exception;
-
- public Collection<ModificationInfo> getModifiedDeployments()
- throws Exception;
-
- // Managed object attachments for a deployment
- public void addManagedObject(String vfsPath, Attachments edits)
- throws Exception;
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.profileservice.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * An interface for managing the contents of a Profile.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentRepository
+{
+ public void create() throws Exception;
+ public void load() throws Exception;
+ public void remove() throws Exception;
+ public long getLastModified();
+
+ public URI getDeploymentURI(DeploymentPhase phase);
+ public void setDeploymentURI(URI uri, DeploymentPhase phase);
+
+ public Set<String> getDeploymentNames();
+ public Set<String> getDeploymentNames(DeploymentPhase phase);
+
+
+ /**
+ * Upload raw deployment content to a profile repository. This does not make
+ * the deployment avaialble to
+ * @param vfsPath - the vfs path relative to the phase root
+ * @param contentIS - the input stream for the deployment contents
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @throws IOException
+ * @return the unique name of the deployment in the repository
+ */
+ public String addDeploymentContent(String vfsPath, InputStream contentIS, DeploymentPhase phase)
+ throws IOException;
+
+ /**
+ * Get repository names.
+ *
+ * @param names the names
+ * @param phase the deployment phase
+ * @return full repository names
+ * @throws IOException for any error
+ */
+ public String[] getRepositoryNames(String[] names, DeploymentPhase phase)
+ throws IOException;
+
+ /**
+ * Get the repository virtual file for the given deployment name
+ * @param name - the unique virtual file URI name as returned by addDeploymentContent
+ * @param phase - the phase of the deployment as it relates to when the deployment is loaded
+ * @return the deployment content virtual file
+ * @throws IOException for any error
+ */
+ public VirtualFile getDeploymentContent(String name, DeploymentPhase phase)
+ throws IOException, URISyntaxException;
+
+ /**
+ * lock deployment content and exclude it from modified deployment checks.
+ * @param vfsPath - the content vfs path relative to the deployment phase root
+ * @param phase - the deployment phase
+ * @return the deployment content flags, {@linkplain DeploymentContentFlags}
+ */
+ public int lockDeploymentContent(String vfsPath, DeploymentPhase phase);
+ /**
+ * Unlock a previously locked deployment content.
+ * @param vfsPath - the content vfs path relative to the deployment phase root
+ * @param phase - the deployment phase
+ * @return the deployment content flags, {@linkplain DeploymentContentFlags}
+ */
+ public int unlockDeploymentContent(String vfsPath, DeploymentPhase phase);
+
+ /**
+ * Get the status flags for the deployment path
+ * @param vfsPath - the content vfs path relative to the deployment phase root
+ * @param phase - the deployment phase
+ * @return the deployment content flags, {@linkplain DeploymentContentFlags}
+ */
+ public int getDeploymentContentFlags(String vfsPath, DeploymentPhase phase);
+ /**
+ * Set one or more flags for the deployment.
+ * @see #clearDeploymentContentFlags(String, DeploymentPhase, int)
+ *
+ * @param vfsPath - the content vfs path relative to the deployment phase root
+ * @param phase - the deployment phase
+ * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
+ */
+ public int setDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
+ int flags);
+ /**
+ * Clear one or more flags for the deployment. This ands the compliment of
+ * the flags argument into the existing content flags and returns the result.
+ *
+ * @param vfsPath - the content vfs path relative to the deployment phase root
+ * @param phase - the deployment phase
+ * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
+ */
+ public int clearDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
+ int flags);
+ /**
+ * Does a deployment content have the indicated flag.
+ *
+ * @param vfsPath - the content vfs path relative to the deployment phase root
+ * @param phase - the deployment phase
+ * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
+ * @return true if the content flags contains the flag, false otherwise.
+ */
+ public boolean hasDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
+ int flag);
+
+ /**
+ * Acquire the repository write lock. This generally prevents content
+ * uploads and {@link #getModifiedDeployments()} calls while the lock is
+ * held.
+ */
+ public void acquireDeploymentContentLock();
+ /**
+ * Release the previously aquired repository write lock.
+ */
+ public void releaseDeploymentContentLock();
+
+ /**
+ * Add a deployment
+ *
+ * @param vfsPath the path
+ * @param d the deployment
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @throws Exception for any error
+ */
+ public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
+ throws Exception;
+ /**
+ * Update a deployments attachments. This persists the deployments
+ * pre-determined attachments.
+ *
+ * @param vfsPath - the vfs path relative to the phase root for the deployment
+ * @param phase - the deployment phase
+ * @param attachments - the attachments that have been modified
+ * @throws Exception
+ */
+ public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
+ Map<String, Object> attachments)
+ throws Exception;
+ /**
+ * Get a named deployment.
+ *
+ * @param name - the deployment name
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @return the named bootstrap
+ * @throws NoSuchDeploymentException - if there is no such bootstrap
+ * @throws IOException
+ * @throws Exception for any error
+ */
+ public VFSDeployment getDeployment(String name, DeploymentPhase phase)
+ throws NoSuchDeploymentException, Exception;
+
+ /**
+ * Remove a deployment
+ *
+ * @param vfsPath - the vfs path
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @return the removed deployment
+ * @throws Exception for any error
+ */
+ public VFSDeployment removeDeployment(String vfsPath, DeploymentPhase phase)
+ throws Exception;
+
+ /**
+ * Get all deployments for the given phase defined in this profile
+ *
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @return the bootstrap instances in this profile.
+ * @throws Exception for any error
+ */
+ public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
+ throws Exception;
+ /**
+ * Get all deployments defined in this profile
+ *
+ * @return the deployment instances in this profile.
+ * @throws Exception for any error
+ */
+ public Collection<VFSDeployment> getDeployments()
+ throws Exception;
+
+ public Collection<ModificationInfo> getModifiedDeployments()
+ throws Exception;
+
+ // Managed object attachments for a deployment
+ public void addManagedObject(String vfsPath, Attachments edits)
+ throws Exception;
+
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/NoSuchDeploymentException.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/NoSuchDeploymentException.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/NoSuchDeploymentException.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,48 +1,48 @@
-/*
- * 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.profileservice.spi;
-
-/**
- * An exception thrown when there is no matching deployment.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class NoSuchDeploymentException extends Exception
-{
- private static final long serialVersionUID = 1;
-
- public NoSuchDeploymentException()
- {
- }
-
- public NoSuchDeploymentException(String msg)
- {
- super(msg);
- }
-
- public NoSuchDeploymentException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
-
-}
+/*
+ * 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.profileservice.spi;
+
+/**
+ * An exception thrown when there is no matching deployment.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class NoSuchDeploymentException extends Exception
+{
+ private static final long serialVersionUID = 1;
+
+ public NoSuchDeploymentException()
+ {
+ }
+
+ public NoSuchDeploymentException(String msg)
+ {
+ super(msg);
+ }
+
+ public NoSuchDeploymentException(String msg, Throwable cause)
+ {
+ super(msg, cause);
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/NoSuchDeploymentException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/NoSuchProfileException.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/NoSuchProfileException.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/NoSuchProfileException.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,49 +1,49 @@
-/*
- * 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.profileservice.spi;
-
-/**
- * Exception thrown when a profile query failes to find a match.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class NoSuchProfileException extends Exception
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 461561859030090797L;
-
- public NoSuchProfileException(String message)
- {
- super(message);
- }
-
- public NoSuchProfileException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public NoSuchProfileException(Throwable cause)
- {
- super(cause);
- }
-}
+/*
+ * 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.profileservice.spi;
+
+/**
+ * Exception thrown when a profile query failes to find a match.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class NoSuchProfileException extends Exception
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 461561859030090797L;
+
+ public NoSuchProfileException(String message)
+ {
+ super(message);
+ }
+
+ public NoSuchProfileException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public NoSuchProfileException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/NoSuchProfileException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/Profile.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/Profile.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,184 +1,184 @@
-/*
- * 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.profileservice.spi;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A profile represents a named collection of deployments on a server
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public interface Profile
-{
- /**
- * Get the key used to create the Profile
- * @return the key used to create the Profile
- */
- ProfileKey getKey();
-
- /**
- * The x.y.z version of the profile
- *
- * @return the version if known, null if its unspecified.
- */
- String getVersion();
-
- /**
- * Get the system time in milliseconds the profile was last modified.
- * @return System.currentTimeMillis of last modification
- */
- long getLastModified();
-
- /**
- * Get the names of the deployments in the profile
- * @return names of deployments
- */
- Set<String> getDeploymentNames();
-
- /**
- * Get the names of the deployments for the given phase defined in this profile
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @return names of deployments
- */
- Set<String> getDeploymentNames(DeploymentPhase phase);
-
- //public DeploymentInfo getDeploymentInfo(String name);
-
- /**
- * Get the root for deployments of the given phase.
- *
- * @param phase the deployment phase
- * @return the VirtualFile directory that contains deployments of the
- * given phase.
- * @throws Exception for any error
- */
- VirtualFile getRootFile(DeploymentPhase phase) throws Exception;
-
- /**
- * Add a deployment
- *
- * @param d the deployment
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @throws Exception for any error
- */
- void addDeployment(VFSDeployment d, DeploymentPhase phase) throws Exception;
-
- /**
- * Update a deployment. This can be used to save attachments, other
- * metadata of the deployment.
- *
- * @param d the deployment
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @param attachments - the attachments that have been modified
- * @throws Exception for any error
- */
- void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- Map<String, Object> attachments)
- throws Exception;
-
- /**
- * Remove a deployment
- *
- * @param name the deployment name
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @return the DeploymentContext for the name if found
- * @throws Exception for any error
- */
- VFSDeployment removeDeployment(String name, DeploymentPhase phase) throws Exception;
-
- /**
- * Get a named deployment.
- *
- * @param name - the deployment name
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded. If null, then all phases are queried.
- * @return the named bootstrap
- * @throws Exception for any error
- * @throws NoSuchDeploymentException - if there is no such bootstrap
- */
- VFSDeployment getDeployment(String name, DeploymentPhase phase) throws Exception, NoSuchDeploymentException;
-
- /**
- * @param phase - the phase of the deployment as it relates to when the
- * deployment is loaded
- * @return the bootstrap instances in this profile.
- * @throws Exception for any error
- */
- Collection<VFSDeployment> getDeployments(DeploymentPhase phase) throws Exception;
-
- /**
- * Get all deployments defined in this profile
- *
- * @return the deployment instances in this profile.
- * @throws Exception for any error
- */
- Collection<VFSDeployment> getDeployments() throws Exception;
-
- /**
- * Get the deployments that have been modified since the last
- * check.
- *
- * @return the modified deployments, empty if none exist or
- * the profile does not support hot deployments.
- *
- * @throws Exception - thrown on error scanning for deployments
- */
- Collection<ModificationInfo> getModifiedDeployments() throws Exception;
-
- /**
- * Enable/disable the getModifiedDeployments results. This can be
- * used to disable the getModifiedDeployments results during
- * periods such as bootstrap where changes should be delayed.
- * @see #getModifiedDeployments
- * @param flag - the enable/disable flag
- */
- void enableModifiedDeploymentChecks(boolean flag);
-
- /**
- * Get the config
- *
- * @return the config
- */
- Map<String, Object> getConfig();
-
- /**
- * Checks whether a deployment context is available in the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return true if the deployment is found or false otherwise
- */
- boolean hasDeployment(String name, DeploymentPhase phase);
-}
+/*
+ * 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.profileservice.spi;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A profile represents a named collection of deployments on a server
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public interface Profile
+{
+ /**
+ * Get the key used to create the Profile
+ * @return the key used to create the Profile
+ */
+ ProfileKey getKey();
+
+ /**
+ * The x.y.z version of the profile
+ *
+ * @return the version if known, null if its unspecified.
+ */
+ String getVersion();
+
+ /**
+ * Get the system time in milliseconds the profile was last modified.
+ * @return System.currentTimeMillis of last modification
+ */
+ long getLastModified();
+
+ /**
+ * Get the names of the deployments in the profile
+ * @return names of deployments
+ */
+ Set<String> getDeploymentNames();
+
+ /**
+ * Get the names of the deployments for the given phase defined in this profile
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @return names of deployments
+ */
+ Set<String> getDeploymentNames(DeploymentPhase phase);
+
+ //public DeploymentInfo getDeploymentInfo(String name);
+
+ /**
+ * Get the root for deployments of the given phase.
+ *
+ * @param phase the deployment phase
+ * @return the VirtualFile directory that contains deployments of the
+ * given phase.
+ * @throws Exception for any error
+ */
+ VirtualFile getRootFile(DeploymentPhase phase) throws Exception;
+
+ /**
+ * Add a deployment
+ *
+ * @param d the deployment
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @throws Exception for any error
+ */
+ void addDeployment(VFSDeployment d, DeploymentPhase phase) throws Exception;
+
+ /**
+ * Update a deployment. This can be used to save attachments, other
+ * metadata of the deployment.
+ *
+ * @param d the deployment
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @param attachments - the attachments that have been modified
+ * @throws Exception for any error
+ */
+ void updateDeployment(VFSDeployment d, DeploymentPhase phase,
+ Map<String, Object> attachments)
+ throws Exception;
+
+ /**
+ * Remove a deployment
+ *
+ * @param name the deployment name
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @return the DeploymentContext for the name if found
+ * @throws Exception for any error
+ */
+ VFSDeployment removeDeployment(String name, DeploymentPhase phase) throws Exception;
+
+ /**
+ * Get a named deployment.
+ *
+ * @param name - the deployment name
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded. If null, then all phases are queried.
+ * @return the named bootstrap
+ * @throws Exception for any error
+ * @throws NoSuchDeploymentException - if there is no such bootstrap
+ */
+ VFSDeployment getDeployment(String name, DeploymentPhase phase) throws Exception, NoSuchDeploymentException;
+
+ /**
+ * @param phase - the phase of the deployment as it relates to when the
+ * deployment is loaded
+ * @return the bootstrap instances in this profile.
+ * @throws Exception for any error
+ */
+ Collection<VFSDeployment> getDeployments(DeploymentPhase phase) throws Exception;
+
+ /**
+ * Get all deployments defined in this profile
+ *
+ * @return the deployment instances in this profile.
+ * @throws Exception for any error
+ */
+ Collection<VFSDeployment> getDeployments() throws Exception;
+
+ /**
+ * Get the deployments that have been modified since the last
+ * check.
+ *
+ * @return the modified deployments, empty if none exist or
+ * the profile does not support hot deployments.
+ *
+ * @throws Exception - thrown on error scanning for deployments
+ */
+ Collection<ModificationInfo> getModifiedDeployments() throws Exception;
+
+ /**
+ * Enable/disable the getModifiedDeployments results. This can be
+ * used to disable the getModifiedDeployments results during
+ * periods such as bootstrap where changes should be delayed.
+ * @see #getModifiedDeployments
+ * @param flag - the enable/disable flag
+ */
+ void enableModifiedDeploymentChecks(boolean flag);
+
+ /**
+ * Get the config
+ *
+ * @return the config
+ */
+ Map<String, Object> getConfig();
+
+ /**
+ * Checks whether a deployment context is available in the basic profile service.
+ *
+ * @param name the name of the deployment
+ * @param phase optionally a deployment phase, if null search all
+ * @return true if the deployment is found or false otherwise
+ */
+ boolean hasDeployment(String name, DeploymentPhase phase);
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/ProfileConfiguration.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ProfileConfiguration.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ProfileConfiguration.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,32 +1,32 @@
-/*
- * 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.profileservice.spi;
-
-/**
- * The configuration of the deployments that make up a profile
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface ProfileConfiguration
-{
- public Profile getProfile();
-}
+/*
+ * 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.profileservice.spi;
+
+/**
+ * The configuration of the deployments that make up a profile
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ProfileConfiguration
+{
+ public Profile getProfile();
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/ProfileConfiguration.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/ProfileKey.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ProfileKey.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ProfileKey.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,138 +1,138 @@
-package org.jboss.profileservice.spi;
-
-import java.io.Serializable;
-
-/**
- * The key for a Profile. It consists of the domain, server and name.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class ProfileKey
- implements Comparable, Serializable
-{
- private static final long serialVersionUID = 1;
- /** The DEFAULT value for domain, server, name */
- public static final String DEFAULT = "default";
-
- /** The profile domain/cluster */
- private String domain;
- /** The server/node */
- private String server;
- /** The profile name */
- private String name;
-
- /**
- * Calls this this(DEFAULT, DEFAULT, name)
- * @param name - the profile name
- */
- public ProfileKey(String name)
- {
- this(DEFAULT, DEFAULT, name);
- }
-
- /**
- * Build a profile key from the domain, server and name. If any parameter
- * is null it defaulted to "default".
- *
- * @param domain - the admin domain
- * @param server - the server instance name
- * @param name - the profile name
- */
- public ProfileKey(String domain, String server, String name)
- {
- if( domain == null )
- domain = DEFAULT;
- this.domain = domain;
- if( server == null )
- server = DEFAULT;
- this.server = server;
- if( name == null )
- name = DEFAULT;
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getDomain()
- {
- return domain;
- }
- public void setDomain(String domain)
- {
- this.domain = domain;
- }
-
- public String getServer()
- {
- return server;
- }
- public void setServer(String server)
- {
- this.server = server;
- }
-
- /**
- * Is this a default key. A default key is one where all
- * fields are {@link #DEFAULT}
- * @return true if default, false otherwise.
- */
- public boolean isDefaultKey()
- {
- return DEFAULT.equalsIgnoreCase(domain)
- && DEFAULT.equalsIgnoreCase(server)
- && DEFAULT.equalsIgnoreCase(name);
- }
-
- /**
- * Compare based on domain, then server and finally name.
- *
- * @param o - the ProfileKey instance to compare to
- * @return < 0, 0, > 0 based on whether this is less than, equal to
- * or greater than o.
- */
- public int compareTo(Object o)
- {
- ProfileKey pk = (ProfileKey) o;
- int compareTo = domain.compareTo(pk.domain);
- if( compareTo == 0 )
- {
- compareTo = server.compareTo(pk.server);
- if( compareTo == 0 )
- {
- compareTo = name.compareTo(pk.name);
- }
- }
- return compareTo;
- }
- public boolean equals(Object o)
- {
- return compareTo(o) == 0;
- }
- public int hashCode()
- {
- int hash = domain.hashCode() + server.hashCode() + name.hashCode();
- return hash;
- }
-
- public String toString()
- {
- StringBuilder tmp = new StringBuilder(super.toString());
- tmp.append('[');
- tmp.append("domain=");
- tmp.append(domain);
- tmp.append(",server=");
- tmp.append(server);
- tmp.append(",name=");
- tmp.append(name);
- tmp.append(']');
- return tmp.toString();
- }
-}
+package org.jboss.profileservice.spi;
+
+import java.io.Serializable;
+
+/**
+ * The key for a Profile. It consists of the domain, server and name.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ProfileKey
+ implements Comparable, Serializable
+{
+ private static final long serialVersionUID = 1;
+ /** The DEFAULT value for domain, server, name */
+ public static final String DEFAULT = "default";
+
+ /** The profile domain/cluster */
+ private String domain;
+ /** The server/node */
+ private String server;
+ /** The profile name */
+ private String name;
+
+ /**
+ * Calls this this(DEFAULT, DEFAULT, name)
+ * @param name - the profile name
+ */
+ public ProfileKey(String name)
+ {
+ this(DEFAULT, DEFAULT, name);
+ }
+
+ /**
+ * Build a profile key from the domain, server and name. If any parameter
+ * is null it defaulted to "default".
+ *
+ * @param domain - the admin domain
+ * @param server - the server instance name
+ * @param name - the profile name
+ */
+ public ProfileKey(String domain, String server, String name)
+ {
+ if( domain == null )
+ domain = DEFAULT;
+ this.domain = domain;
+ if( server == null )
+ server = DEFAULT;
+ this.server = server;
+ if( name == null )
+ name = DEFAULT;
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getDomain()
+ {
+ return domain;
+ }
+ public void setDomain(String domain)
+ {
+ this.domain = domain;
+ }
+
+ public String getServer()
+ {
+ return server;
+ }
+ public void setServer(String server)
+ {
+ this.server = server;
+ }
+
+ /**
+ * Is this a default key. A default key is one where all
+ * fields are {@link #DEFAULT}
+ * @return true if default, false otherwise.
+ */
+ public boolean isDefaultKey()
+ {
+ return DEFAULT.equalsIgnoreCase(domain)
+ && DEFAULT.equalsIgnoreCase(server)
+ && DEFAULT.equalsIgnoreCase(name);
+ }
+
+ /**
+ * Compare based on domain, then server and finally name.
+ *
+ * @param o - the ProfileKey instance to compare to
+ * @return < 0, 0, > 0 based on whether this is less than, equal to
+ * or greater than o.
+ */
+ public int compareTo(Object o)
+ {
+ ProfileKey pk = (ProfileKey) o;
+ int compareTo = domain.compareTo(pk.domain);
+ if( compareTo == 0 )
+ {
+ compareTo = server.compareTo(pk.server);
+ if( compareTo == 0 )
+ {
+ compareTo = name.compareTo(pk.name);
+ }
+ }
+ return compareTo;
+ }
+ public boolean equals(Object o)
+ {
+ return compareTo(o) == 0;
+ }
+ public int hashCode()
+ {
+ int hash = domain.hashCode() + server.hashCode() + name.hashCode();
+ return hash;
+ }
+
+ public String toString()
+ {
+ StringBuilder tmp = new StringBuilder(super.toString());
+ tmp.append('[');
+ tmp.append("domain=");
+ tmp.append(domain);
+ tmp.append(",server=");
+ tmp.append(server);
+ tmp.append(",name=");
+ tmp.append(name);
+ tmp.append(']');
+ return tmp.toString();
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/ProfileKey.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,73 +1,73 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.profileservice.spi;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * An interface for obtaining DeploymentRepository for a Profile.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public interface ProfileRepository
-{
- /**
- * Get the keys for all known profiles
- * @return keys for all known profiles
- */
- public Collection<ProfileKey> getProfileKeys();
-
- /**
- * Create a new DeploymentRepository for a profile.
- *
- * @param key - the key for the Profile to create the DeploymentRepository for.
- * @return the profile DeploymentRepository
- * @throws IOException thrown if the repository cannot be created or
- * already exists
- * @throws Exception for any error
- */
- public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
- throws Exception;
-
- /**
- * Get the DeploymentRepository for the given profile key.
- *
- * @param key - the key for the Profile to obtain the DeploymentRepository for.
- * @return the profile DeploymentRepository
- * @throws NoSuchProfileException thrown if there is no such profile.
- * @throws Exception for any error
- */
- public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
- throws Exception, NoSuchProfileException;
-
- /**
- * Remove the DeploymentRepository for the given profile key.
- * @param key - the key for the Profile to obtain the DeploymentRepository for.
- * @throws IOException thrown on error removing the repository
- * @throws NoSuchProfileException thrown if there is no such profile.
- * @throws Exception for any error
- */
- public void removeProfileDeploymentRepository(ProfileKey key)
- throws Exception, NoSuchProfileException;
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.profileservice.spi;
+
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * An interface for obtaining DeploymentRepository for a Profile.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface ProfileRepository
+{
+ /**
+ * Get the keys for all known profiles
+ * @return keys for all known profiles
+ */
+ public Collection<ProfileKey> getProfileKeys();
+
+ /**
+ * Create a new DeploymentRepository for a profile.
+ *
+ * @param key - the key for the Profile to create the DeploymentRepository for.
+ * @return the profile DeploymentRepository
+ * @throws IOException thrown if the repository cannot be created or
+ * already exists
+ * @throws Exception for any error
+ */
+ public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
+ throws Exception;
+
+ /**
+ * Get the DeploymentRepository for the given profile key.
+ *
+ * @param key - the key for the Profile to obtain the DeploymentRepository for.
+ * @return the profile DeploymentRepository
+ * @throws NoSuchProfileException thrown if there is no such profile.
+ * @throws Exception for any error
+ */
+ public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
+ throws Exception, NoSuchProfileException;
+
+ /**
+ * Remove the DeploymentRepository for the given profile key.
+ * @param key - the key for the Profile to obtain the DeploymentRepository for.
+ * @throws IOException thrown on error removing the repository
+ * @throws NoSuchProfileException thrown if there is no such profile.
+ * @throws Exception for any error
+ */
+ public void removeProfileDeploymentRepository(ProfileKey key)
+ throws Exception, NoSuchProfileException;
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,99 +1,99 @@
-/*
- * 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.profileservice.spi;
-
-import java.util.Collection;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-
-/**
- * The entry point service for accessing/administiring server profiles
- *
- * @todo this should be broken up into different feature plugin services
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface ProfileService
-{
- // Querying profiles
-
- /**
- * Get the unique domains for which profiles exist
- * @return array of profile domains
- */
- public String[] getDomains();
-
- /**
- * Get the keys for all known profiles
- * @return keys for all known profiles
- */
- public Collection<ProfileKey> getProfileKeys();
-
- /**
- * Obtain the profile for the key.
- *
- * @param key - the key for the profile
- * @return the matching profile.
- * @throws NoSuchProfileException
- */
- public Profile getProfile(ProfileKey key)
- throws NoSuchProfileException;
-
- /**
- * Get the active profile.
- * @return the active profile
- * @throws NoSuchProfileException thrown if there is no
- * active profile
- */
- public Profile getActiveProfile()
- throws NoSuchProfileException;
-
- /**
- * Get a list of the deployment names associated with a profile.
- * @param key - the key for the profile
- * @return the list of deployment names.
- * @throws NoSuchProfileException
- */
- public String[] getProfileDeploymentNames(ProfileKey key)
- throws NoSuchProfileException;
-
- /**
- * Obtain the ManagementView plugin
- * @return the ManagementView plugin if supported
- */
- public ManagementView getViewManager();
-
- /**
- * Obtain the DeploymentManager plugin
- * @return the DeploymentManager plugin if supported
- */
- public DeploymentManager getDeploymentManager();
-
- // Admin of profiles @todo could be an option plugin
- public Profile newProfile(ProfileKey key)
- throws Exception;
- public void removeProfile(ProfileKey key)
- throws Exception;
-
-}
+/*
+ * 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.profileservice.spi;
+
+import java.util.Collection;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+
+/**
+ * The entry point service for accessing/administiring server profiles
+ *
+ * @todo this should be broken up into different feature plugin services
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ProfileService
+{
+ // Querying profiles
+
+ /**
+ * Get the unique domains for which profiles exist
+ * @return array of profile domains
+ */
+ public String[] getDomains();
+
+ /**
+ * Get the keys for all known profiles
+ * @return keys for all known profiles
+ */
+ public Collection<ProfileKey> getProfileKeys();
+
+ /**
+ * Obtain the profile for the key.
+ *
+ * @param key - the key for the profile
+ * @return the matching profile.
+ * @throws NoSuchProfileException
+ */
+ public Profile getProfile(ProfileKey key)
+ throws NoSuchProfileException;
+
+ /**
+ * Get the active profile.
+ * @return the active profile
+ * @throws NoSuchProfileException thrown if there is no
+ * active profile
+ */
+ public Profile getActiveProfile()
+ throws NoSuchProfileException;
+
+ /**
+ * Get a list of the deployment names associated with a profile.
+ * @param key - the key for the profile
+ * @return the list of deployment names.
+ * @throws NoSuchProfileException
+ */
+ public String[] getProfileDeploymentNames(ProfileKey key)
+ throws NoSuchProfileException;
+
+ /**
+ * Obtain the ManagementView plugin
+ * @return the ManagementView plugin if supported
+ */
+ public ManagementView getViewManager();
+
+ /**
+ * Obtain the DeploymentManager plugin
+ * @return the DeploymentManager plugin if supported
+ */
+ public DeploymentManager getDeploymentManager();
+
+ // Admin of profiles @todo could be an option plugin
+ public Profile newProfile(ProfileKey key)
+ throws Exception;
+ public void removeProfile(ProfileKey key)
+ throws Exception;
+
+}
Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java
===================================================================
--- trunk/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,156 +1,156 @@
-/*
-* 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.system.deployers;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.helpers.DefaultDeploymentContextComparator;
-
-/**
- * Legacy deployment sorter
- *
- * @author ales.justin at jboss.org
- * @see org.jboss.deployment.DeploymentSorter in system-jmx
- * @see org.jboss.deployment.SuffixOrderHelper in system-jmx
- */
-public class LegacyDeploymentContextComparator extends DefaultDeploymentContextComparator
-{
- /** The instance */
- public static final LegacyDeploymentContextComparator INSTANCE = new LegacyDeploymentContextComparator();
- /** Legacy orders */
- private static Map<String, Integer> legacyOrder;
-
- static
- {
- legacyOrder = new HashMap<String, Integer>();
- legacyOrder.put(".deployer", 50);
- legacyOrder.put("-deployer.xml", 50);
- legacyOrder.put(".aop", 100);
- legacyOrder.put("-aop.xml", 100);
- legacyOrder.put(".sar", 150);
- legacyOrder.put("-service.xml", 150);
- legacyOrder.put(".beans", 200);
- legacyOrder.put("-jboss-beans.xml", 200);
- legacyOrder.put(".rar", 250);
- legacyOrder.put("-ds.xml", 300);
- legacyOrder.put(".har", 350);
- legacyOrder.put(".jar", 400);
- legacyOrder.put(".ejb3", 400);
- legacyOrder.put(".par", 400);
- legacyOrder.put(".war", 500);
- legacyOrder.put(".wsr", 600);
- legacyOrder.put(".ear", 650);
- legacyOrder.put(".jar", 700);
- legacyOrder.put(".zip", 750);
- legacyOrder.put(".bsh", 800);
- legacyOrder.put(".last", 900);
- }
-
- private boolean useDefaults = true;
- private Map<String, Integer> suffixOrder;
- private int defaultOrder = 850;
-
- /**
- * Get the instance.
- *
- * @return the instance
- */
- public static LegacyDeploymentContextComparator getInstance()
- {
- return INSTANCE;
- }
-
- public int compare(DeploymentContext fst, DeploymentContext snd)
- {
- int fstOrder = getContextOrder(fst);
- int sndOrder = getContextOrder(snd);
- int diff = fstOrder - sndOrder;
- if (diff != 0)
- return diff;
- else
- return super.compare(fst, snd);
- }
-
- /**
- * Get context's order.
- *
- * @param context the deployment context
- * @return context's order, or default if no match
- */
- protected int getContextOrder(DeploymentContext context)
- {
- String simpleName = context.getSimpleName();
- for (Map.Entry<String, Integer> entry : suffixOrder.entrySet())
- {
- if (simpleName.endsWith(entry.getKey()))
- return entry.getValue();
- }
- return defaultOrder;
- }
-
- public void create()
- {
- Map<String, Integer> map = new HashMap<String, Integer>();
- if (useDefaults)
- map.putAll(legacyOrder);
- if (suffixOrder != null)
- map.putAll(suffixOrder);
- suffixOrder = map;
- }
-
- /**
- * Should we use defaults.
- *
- * @param useDefaults default flag
- */
- public void setUseDefaults(boolean useDefaults)
- {
- this.useDefaults = useDefaults;
- }
-
- /**
- * Set suffix order map.
- *
- * @param suffixOrder the suffix order map
- */
- public void setSuffixOrder(Map<String, Integer> suffixOrder)
- {
- this.suffixOrder = suffixOrder;
- }
-
- /**
- * Set default order.
- *
- * @param defaultOrder the default order
- */
- public void setDefaultOrder(int defaultOrder)
- {
- this.defaultOrder = defaultOrder;
- }
-
- Object readResolve()
- {
- return INSTANCE;
- }
+/*
+* 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.system.deployers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.DefaultDeploymentContextComparator;
+
+/**
+ * Legacy deployment sorter
+ *
+ * @author ales.justin at jboss.org
+ * @see org.jboss.deployment.DeploymentSorter in system-jmx
+ * @see org.jboss.deployment.SuffixOrderHelper in system-jmx
+ */
+public class LegacyDeploymentContextComparator extends DefaultDeploymentContextComparator
+{
+ /** The instance */
+ public static final LegacyDeploymentContextComparator INSTANCE = new LegacyDeploymentContextComparator();
+ /** Legacy orders */
+ private static Map<String, Integer> legacyOrder;
+
+ static
+ {
+ legacyOrder = new HashMap<String, Integer>();
+ legacyOrder.put(".deployer", 50);
+ legacyOrder.put("-deployer.xml", 50);
+ legacyOrder.put(".aop", 100);
+ legacyOrder.put("-aop.xml", 100);
+ legacyOrder.put(".sar", 150);
+ legacyOrder.put("-service.xml", 150);
+ legacyOrder.put(".beans", 200);
+ legacyOrder.put("-jboss-beans.xml", 200);
+ legacyOrder.put(".rar", 250);
+ legacyOrder.put("-ds.xml", 300);
+ legacyOrder.put(".har", 350);
+ legacyOrder.put(".jar", 400);
+ legacyOrder.put(".ejb3", 400);
+ legacyOrder.put(".par", 400);
+ legacyOrder.put(".war", 500);
+ legacyOrder.put(".wsr", 600);
+ legacyOrder.put(".ear", 650);
+ legacyOrder.put(".jar", 700);
+ legacyOrder.put(".zip", 750);
+ legacyOrder.put(".bsh", 800);
+ legacyOrder.put(".last", 900);
+ }
+
+ private boolean useDefaults = true;
+ private Map<String, Integer> suffixOrder;
+ private int defaultOrder = 850;
+
+ /**
+ * Get the instance.
+ *
+ * @return the instance
+ */
+ public static LegacyDeploymentContextComparator getInstance()
+ {
+ return INSTANCE;
+ }
+
+ public int compare(DeploymentContext fst, DeploymentContext snd)
+ {
+ int fstOrder = getContextOrder(fst);
+ int sndOrder = getContextOrder(snd);
+ int diff = fstOrder - sndOrder;
+ if (diff != 0)
+ return diff;
+ else
+ return super.compare(fst, snd);
+ }
+
+ /**
+ * Get context's order.
+ *
+ * @param context the deployment context
+ * @return context's order, or default if no match
+ */
+ protected int getContextOrder(DeploymentContext context)
+ {
+ String simpleName = context.getSimpleName();
+ for (Map.Entry<String, Integer> entry : suffixOrder.entrySet())
+ {
+ if (simpleName.endsWith(entry.getKey()))
+ return entry.getValue();
+ }
+ return defaultOrder;
+ }
+
+ public void create()
+ {
+ Map<String, Integer> map = new HashMap<String, Integer>();
+ if (useDefaults)
+ map.putAll(legacyOrder);
+ if (suffixOrder != null)
+ map.putAll(suffixOrder);
+ suffixOrder = map;
+ }
+
+ /**
+ * Should we use defaults.
+ *
+ * @param useDefaults default flag
+ */
+ public void setUseDefaults(boolean useDefaults)
+ {
+ this.useDefaults = useDefaults;
+ }
+
+ /**
+ * Set suffix order map.
+ *
+ * @param suffixOrder the suffix order map
+ */
+ public void setSuffixOrder(Map<String, Integer> suffixOrder)
+ {
+ this.suffixOrder = suffixOrder;
+ }
+
+ /**
+ * Set default order.
+ *
+ * @param defaultOrder the default order
+ */
+ public void setDefaultOrder(int defaultOrder)
+ {
+ this.defaultOrder = defaultOrder;
+ }
+
+ Object readResolve()
+ {
+ return INSTANCE;
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,55 +1,55 @@
-/*
-* 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.system.deployers;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer;
-import org.jboss.kernel.Kernel;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TempBeanMetaDataDeployer extends BeanMetaDataDeployer
-{
- public TempBeanMetaDataDeployer(Kernel kernel)
- {
- super(kernel);
- }
-
- public void deploy(DeploymentUnit unit, BeanMetaData deployment) throws DeploymentException
- {
- ClassLoader old = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(unit.getClassLoader());
- try
- {
- super.deploy(unit, deployment);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(old);
- }
- }
-}
+/*
+* 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.system.deployers;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer;
+import org.jboss.kernel.Kernel;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TempBeanMetaDataDeployer extends BeanMetaDataDeployer
+{
+ public TempBeanMetaDataDeployer(Kernel kernel)
+ {
+ super(kernel);
+ }
+
+ public void deploy(DeploymentUnit unit, BeanMetaData deployment) throws DeploymentException
+ {
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(unit.getClassLoader());
+ try
+ {
+ super.deploy(unit, deployment);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(old);
+ }
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,54 +1,54 @@
-/*
- * 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.server.profile.basic;
-
-import java.util.regex.Pattern;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Pattern filter.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class AbstractPatternVirtualFileFilter implements VirtualFileFilter
-{
- private Pattern pattern;
-
- protected AbstractPatternVirtualFileFilter(String patternString)
- {
- this.pattern = Pattern.compile(patternString);
- }
-
- public boolean accepts(VirtualFile file)
- {
- return pattern.matcher(file.getName()).find() == doMatch();
- }
-
- /**
- * Should we match the pattern.
- *
- * @return
- */
- protected abstract boolean doMatch();
+/*
+ * 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.server.profile.basic;
+
+import java.util.regex.Pattern;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Pattern filter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractPatternVirtualFileFilter implements VirtualFileFilter
+{
+ private Pattern pattern;
+
+ protected AbstractPatternVirtualFileFilter(String patternString)
+ {
+ this.pattern = Pattern.compile(patternString);
+ }
+
+ public boolean accepts(VirtualFile file)
+ {
+ return pattern.matcher(file.getName()).find() == doMatch();
+ }
+
+ /**
+ * Should we match the pattern.
+ *
+ * @return
+ */
+ protected abstract boolean doMatch();
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,35 +1,35 @@
-/*
- * 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.server.profile.basic;
-
-/**
- * Exclude .jsp and .(x)html files.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class JspAndHtmlExcludeVirtualFileFilter extends PatternExcludeVirtualFileFilter
-{
- public JspAndHtmlExcludeVirtualFileFilter()
- {
- super("\\.(jsp|[x]?html)$");
- }
+/*
+ * 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.server.profile.basic;
+
+/**
+ * Exclude .jsp and .(x)html files.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JspAndHtmlExcludeVirtualFileFilter extends PatternExcludeVirtualFileFilter
+{
+ public JspAndHtmlExcludeVirtualFileFilter()
+ {
+ super("\\.(jsp|[x]?html)$");
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,188 +1,188 @@
-/*
- * 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.server.profile.basic;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Profile monitoring metadata changes.
- *
- * We need to cache files's last modifed timestamps,
- * since file.getChildren re-caches handlers,
- * hence hasBeenModified is useless.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class MetaDataAwareProfile extends ProfileImpl
-{
- private MainDeployerStructure mainDeployer;
- private VirtualFileFilter filter;
- private Map<String, Long> lastModifiedCache;
-
- public MetaDataAwareProfile(String profileRoot, ProfileKey key)
- {
- super(profileRoot, key);
- lastModifiedCache = new ConcurrentHashMap<String, Long>();
- }
-
- /**
- * Set main deployer structure.
- *
- * @param mainDeployer the main deployer structure
- */
- public void setMainDeployer(MainDeployerStructure mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Set the metadata resources filter.
- *
- * @param filter the metadata resources filter
- */
- public void setFilter(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
-
- protected boolean hasBeenModified(VirtualFile root) throws Exception
- {
- // get file:/ schema
- URI uri = VFSUtils.getCompatibleURI(root);
- File file = new File(uri);
- // if root is file check its modification
- if (file.isFile())
- return root.hasBeenModified();
-
- // else check metadata
- String name = root.toURI().toString();
- VFSDeploymentContext deploymentContext = getDeploymentContext(name);
- if (deploymentContext != null)
- return hasBeenModified(deploymentContext);
-
- log.debug("Falling back to root name: " + root);
- deploymentContext = getDeploymentContext(root.getName());
- if (deploymentContext != null)
- return hasBeenModified(deploymentContext);
-
- return false;
- }
-
- /**
- * Has vfs deployment context been modified.
- *
- * @param deploymentContext the vfs deployment context
- * @return true if modified
- * @throws IOException for any error
- */
- protected boolean hasBeenModified(VFSDeploymentContext deploymentContext) throws IOException
- {
- List<VirtualFile> metadataLocations = deploymentContext.getMetaDataLocations();
- if (metadataLocations != null && metadataLocations.isEmpty() == false)
- {
- for(VirtualFile metadataLocation : metadataLocations)
- {
- List<VirtualFile> children = metadataLocation.getChildren(filter);
- if (children != null && children.isEmpty() == false)
- {
- for(VirtualFile child : children)
- {
- String pathName = child.getPathName();
- Long timestamp = lastModifiedCache.get(pathName);
- long lastModified = child.getLastModified();
- lastModifiedCache.put(pathName, lastModified);
- if (timestamp != null && timestamp < lastModified)
- {
- if (log.isTraceEnabled())
- log.trace("Metadata location modified: " + child);
- return true;
- }
- }
- }
- }
- }
- List<DeploymentContext> childContexts = deploymentContext.getChildren();
- if (childContexts != null && childContexts.isEmpty() == false)
- {
- for (DeploymentContext childContext : childContexts)
- {
- if (childContext instanceof VFSDeploymentContext)
- {
- if (hasBeenModified((VFSDeploymentContext)childContext))
- return true;
- }
- }
- }
- return false;
- }
-
- // expecting all deployments from same context root
- // so path name should group them per deployment unit
- protected void postRemove(VFSDeployment deployment) throws Exception
- {
- VirtualFile root = deployment.getRoot();
- String pathName = root.getPathName();
- if (log.isTraceEnabled())
- log.debug("Removing last modified cache info for: " + pathName);
-
- Iterator<String> iter = lastModifiedCache.keySet().iterator();
- while (iter.hasNext())
- {
- if (iter.next().startsWith(pathName))
- iter.remove();
- }
- }
-
- /**
- * Get deployment context.
- *
- * @param name the deployment context name
- * @return vfs deployment context or null if doesn't exist or not vfs based
- */
- @SuppressWarnings("deprecation")
- protected VFSDeploymentContext getDeploymentContext(String name)
- {
- if (mainDeployer == null)
- throw new IllegalArgumentException("Null main deployer");
-
- DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
- if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
- return null;
-
- return (VFSDeploymentContext)deploymentContext;
- }
-}
+/*
+ * 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.server.profile.basic;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Profile monitoring metadata changes.
+ *
+ * We need to cache files's last modifed timestamps,
+ * since file.getChildren re-caches handlers,
+ * hence hasBeenModified is useless.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MetaDataAwareProfile extends ProfileImpl
+{
+ private MainDeployerStructure mainDeployer;
+ private VirtualFileFilter filter;
+ private Map<String, Long> lastModifiedCache;
+
+ public MetaDataAwareProfile(String profileRoot, ProfileKey key)
+ {
+ super(profileRoot, key);
+ lastModifiedCache = new ConcurrentHashMap<String, Long>();
+ }
+
+ /**
+ * Set main deployer structure.
+ *
+ * @param mainDeployer the main deployer structure
+ */
+ public void setMainDeployer(MainDeployerStructure mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Set the metadata resources filter.
+ *
+ * @param filter the metadata resources filter
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ protected boolean hasBeenModified(VirtualFile root) throws Exception
+ {
+ // get file:/ schema
+ URI uri = VFSUtils.getCompatibleURI(root);
+ File file = new File(uri);
+ // if root is file check its modification
+ if (file.isFile())
+ return root.hasBeenModified();
+
+ // else check metadata
+ String name = root.toURI().toString();
+ VFSDeploymentContext deploymentContext = getDeploymentContext(name);
+ if (deploymentContext != null)
+ return hasBeenModified(deploymentContext);
+
+ log.debug("Falling back to root name: " + root);
+ deploymentContext = getDeploymentContext(root.getName());
+ if (deploymentContext != null)
+ return hasBeenModified(deploymentContext);
+
+ return false;
+ }
+
+ /**
+ * Has vfs deployment context been modified.
+ *
+ * @param deploymentContext the vfs deployment context
+ * @return true if modified
+ * @throws IOException for any error
+ */
+ protected boolean hasBeenModified(VFSDeploymentContext deploymentContext) throws IOException
+ {
+ List<VirtualFile> metadataLocations = deploymentContext.getMetaDataLocations();
+ if (metadataLocations != null && metadataLocations.isEmpty() == false)
+ {
+ for(VirtualFile metadataLocation : metadataLocations)
+ {
+ List<VirtualFile> children = metadataLocation.getChildren(filter);
+ if (children != null && children.isEmpty() == false)
+ {
+ for(VirtualFile child : children)
+ {
+ String pathName = child.getPathName();
+ Long timestamp = lastModifiedCache.get(pathName);
+ long lastModified = child.getLastModified();
+ lastModifiedCache.put(pathName, lastModified);
+ if (timestamp != null && timestamp < lastModified)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Metadata location modified: " + child);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ List<DeploymentContext> childContexts = deploymentContext.getChildren();
+ if (childContexts != null && childContexts.isEmpty() == false)
+ {
+ for (DeploymentContext childContext : childContexts)
+ {
+ if (childContext instanceof VFSDeploymentContext)
+ {
+ if (hasBeenModified((VFSDeploymentContext)childContext))
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ // expecting all deployments from same context root
+ // so path name should group them per deployment unit
+ protected void postRemove(VFSDeployment deployment) throws Exception
+ {
+ VirtualFile root = deployment.getRoot();
+ String pathName = root.getPathName();
+ if (log.isTraceEnabled())
+ log.debug("Removing last modified cache info for: " + pathName);
+
+ Iterator<String> iter = lastModifiedCache.keySet().iterator();
+ while (iter.hasNext())
+ {
+ if (iter.next().startsWith(pathName))
+ iter.remove();
+ }
+ }
+
+ /**
+ * Get deployment context.
+ *
+ * @param name the deployment context name
+ * @return vfs deployment context or null if doesn't exist or not vfs based
+ */
+ @SuppressWarnings("deprecation")
+ protected VFSDeploymentContext getDeploymentContext(String name)
+ {
+ if (mainDeployer == null)
+ throw new IllegalArgumentException("Null main deployer");
+
+ DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
+ if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
+ return null;
+
+ return (VFSDeploymentContext)deploymentContext;
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,40 +1,40 @@
-/*
- * 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.server.profile.basic;
-
-/**
- * Pattern exclude filter.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class PatternExcludeVirtualFileFilter extends AbstractPatternVirtualFileFilter
-{
- public PatternExcludeVirtualFileFilter(String patternString)
- {
- super(patternString);
- }
-
- protected boolean doMatch()
- {
- return false;
- }
+/*
+ * 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.server.profile.basic;
+
+/**
+ * Pattern exclude filter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PatternExcludeVirtualFileFilter extends AbstractPatternVirtualFileFilter
+{
+ public PatternExcludeVirtualFileFilter(String patternString)
+ {
+ super(patternString);
+ }
+
+ protected boolean doMatch()
+ {
+ return false;
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,40 +1,40 @@
-/*
- * 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.server.profile.basic;
-
-/**
- * Pattern include filter.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class PatternIncludeVirtualFileFilter extends AbstractPatternVirtualFileFilter
-{
- public PatternIncludeVirtualFileFilter(String patternString)
- {
- super(patternString);
- }
-
- protected boolean doMatch()
- {
- return true;
- }
+/*
+ * 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.server.profile.basic;
+
+/**
+ * Pattern include filter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PatternIncludeVirtualFileFilter extends AbstractPatternVirtualFileFilter
+{
+ public PatternIncludeVirtualFileFilter(String patternString)
+ {
+ super(patternString);
+ }
+
+ protected boolean doMatch()
+ {
+ return true;
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,511 +1,511 @@
-/*
- * 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.server.profile.basic;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
-import org.jboss.system.server.profileservice.VFSScanner;
-import org.jboss.util.JBossObject;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A basic profile implementation that uses in memory store for the applications.
- * This has to be populated by some other components.
- *
- * @see VFSScanner and subclasses for an example usage.
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class ProfileImpl extends JBossObject implements Profile
-{
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
-
- private ProfileKey key;
- /** The directory containing the profiles */
- private File profileRoot;
- private LinkedHashMap<String, VFSDeployment> bootstraps = new LinkedHashMap<String, VFSDeployment>();
- private LinkedHashMap<String, VFSDeployment> applications = new LinkedHashMap<String, VFSDeployment>();
- private LinkedHashMap<String, VFSDeployment> deployers = new LinkedHashMap<String, VFSDeployment>();
- /** Is hot deployment checking enabled */
- private volatile boolean hotdeployEnabled;
- /** The last time the profile was modified */
- private long lastModified;
-
- public ProfileImpl(String profileRoot, ProfileKey key)
- {
- this.key = key;
- this.profileRoot = new File(profileRoot);
- log.info("Using profile root:"+this.profileRoot.getAbsolutePath());
- }
-
- public String getName()
- {
- return key.getName();
- }
-
- public ProfileKey getKey()
- {
- return key;
- }
-
- public String getVersion()
- {
- return null;
- }
-
-
- public long getLastModified()
- {
- return this.lastModified;
- }
-
- /**
- * Get the names of the applications in the profile
- * @return names of applications
- */
- public Set<String> getDeploymentNames()
- {
- HashSet<String> names = new HashSet<String>();
- names.addAll(this.bootstraps.keySet());
- names.addAll(this.deployers.keySet());
- names.addAll(this.applications.keySet());
- return names;
- }
-
- public VirtualFile getRootFile(DeploymentPhase phase)
- throws Exception
- {
- VirtualFile root = VFS.getRoot(profileRoot.toURI());
- switch( phase )
- {
- case BOOTSTRAP:
- root = root.findChild("conf");
- break;
- case DEPLOYER:
- root = root.findChild("deployers");
- break;
- case APPLICATION:
- root = root.findChild("deploy");
- break;
- }
- return root;
- }
-
- public void addDeployment(VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.addBootstrap(d);
- break;
- case DEPLOYER:
- this.addDeployer(d);
- break;
- case APPLICATION:
- this.addApplication(d);
- break;
- }
- this.lastModified = System.currentTimeMillis();
- }
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- Map<String, Object> attachments)
- throws Exception
- {
-
- }
-
- /**
- * Find a deployment context from the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return the deployment or null if not found
- */
- private VFSDeployment findDeployment(String name, DeploymentPhase phase)
- {
- VFSDeployment d = null;
- if( phase == null )
- {
- // Try all phases
- d = this.getBootstrap(name);
- if( d == null )
- d = this.getDeployer(name);
- if( d == null )
- d = this.getApplication(name);
- }
- else
- {
- switch( phase )
- {
- case BOOTSTRAP:
- d = this.getBootstrap(name);
- break;
- case DEPLOYER:
- d = this.getDeployer(name);
- break;
- case APPLICATION:
- d = this.getApplication(name);
- break;
- }
- }
- return d;
- }
-
- /**
- * Get a deployment context from the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return the deployment or NoSuchDeploymentException
- * @throws NoSuchDeploymentException if the deployment can't be found
- */
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws NoSuchDeploymentException
- {
- VFSDeployment d = findDeployment(name, phase);
- // Make sure we don't return null
- if( d == null )
- throw new NoSuchDeploymentException("name="+name+", phase="+phase);
- return d;
- }
-
- /**
- * Checks whether a deployment context is available in the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return true if the deployment is found or false otherwise
- */
- public boolean hasDeployment(String name, DeploymentPhase phase)
- {
- return findDeployment(name, phase) != null;
- }
-
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- HashSet<String> names = new HashSet<String>();
- switch( phase )
- {
- case BOOTSTRAP:
- names.addAll(this.bootstraps.keySet());
- break;
- case DEPLOYER:
- names.addAll(this.deployers.keySet());
- break;
- case APPLICATION:
- names.addAll(this.applications.keySet());
- break;
- }
- return names;
- }
-
- public Set<String> getDeploymentNamesForType(String type)
- {
- throw new UnsupportedOperationException("getDeploymentNamesForType");
- /** TODO Deployment.getTypes()
- HashSet<String> names = new HashSet<String>();
- for(VFSDeployment d : bootstraps.values())
- {
- if( d.getTypes().contains(type) )
- names.add(d.getName());
- }
- for(VFSDeployment d : deployers.values())
- {
- if( d.getTypes().contains(type) )
- names.add(d.getName());
- }
- for(VFSDeployment d : applications.values())
- {
- if( d.getTypes().contains(type) )
- names.add(d.getName());
- }
- return names;
- */
- }
-
- public Collection<VFSDeployment> getDeployments()
- {
- HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
- deployments.addAll(this.bootstraps.values());
- deployments.addAll(this.deployers.values());
- deployments.addAll(this.applications.values());
- return Collections.unmodifiableCollection(deployments);
- }
-
- /**
- * Go through the applications looking for modifications. This also
- * picks the last application parent directory as the basis for
- * scanning for new deployments.
- * TODO: to handle multiple application/hotdeployment directories a
- * set of parent dirs needs to be built.
- */
- public Collection<ModificationInfo> getModifiedDeployments()
- throws Exception
- {
- if( hotdeployEnabled == false )
- return Collections.emptyList();
-
- ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
- Collection<VFSDeployment> apps = applications.values();
- boolean trace = log.isTraceEnabled();
- if( trace )
- log.trace("Checking applications for modifications");
- VirtualFile applicationDir = null;
- if( apps != null )
- {
- Iterator<VFSDeployment> iter = apps.iterator();
- while( iter.hasNext() )
- {
- VFSDeployment d = iter.next();
- VirtualFile root = d.getRoot();
- // Save the containing parent dir to scan for new deployments
- VirtualFile parent = root.getParent();
- if(parent != null && (applicationDir == null || parent.getPathName().compareTo(applicationDir.getPathName()) < 0 ))
- applicationDir = parent;
- // Check for removal
- if( root.exists() == false )
- {
- long rootLastModified = root.getLastModified();
- ModificationInfo info = new ModificationInfo(d, rootLastModified, ModifyStatus.REMOVED);
- modified.add(info);
- iter.remove();
- if( trace )
- log.trace(root.getPathName() + " was removed");
- postRemove(d);
- }
- // Check for modification
- else if(hasBeenModified(root))
- {
- long rootLastModified = root.getLastModified();
- if( trace )
- log.trace(root.getPathName() + " was modified: " + rootLastModified);
- // Need to create a duplicate ctx
- VFSDeployment deployment2 = deploymentFactory.createVFSDeployment(root);
- ModificationInfo info = new ModificationInfo(deployment2, rootLastModified, ModifyStatus.MODIFIED);
- modified.add(info);
- }
- // TODO: this could check metadata files modifications as well
- }
-
- // If there are no apps, use the default appplication root
- if( applicationDir == null )
- applicationDir = getRootFile(DeploymentPhase.APPLICATION);
- // Now check for additions
- ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
- addDeployments(added, applicationDir);
- for(VirtualFile vf : added)
- {
- VFSDeployment d = deploymentFactory.createVFSDeployment(vf);
- ModificationInfo info = new ModificationInfo(d, vf.getLastModified(), ModifyStatus.ADDED);
- modified.add(info);
- applications.put(d.getName(), d);
- }
- }
- if(modified.size() > 0)
- lastModified = System.currentTimeMillis();
- return modified;
- }
-
- /**
- * Has the root been modified.
- *
- * @param root the virtual file root
- * @return true if modifed
- * @throws Exception for any error
- */
- protected boolean hasBeenModified(VirtualFile root) throws Exception
- {
- return root.hasBeenModified();
- }
-
- /**
- * Apply post remove operation.
- *
- * @param deployment the vfs deployment
- * @throws Exception for any error
- */
- protected void postRemove(VFSDeployment deployment) throws Exception
- {
- // noop here
- }
-
- /**
- * Noop as basic profile does not support hot deployment currently
- */
- public void enableModifiedDeploymentChecks(boolean flag)
- {
- this.hotdeployEnabled = flag;
- }
-
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- {
- Collection<VFSDeployment> deployments = null;
- switch( phase )
- {
- case BOOTSTRAP:
- deployments = this.getBootstraps();
- break;
- case DEPLOYER:
- deployments = this.getDeployers();
- break;
- case APPLICATION:
- deployments = this.getApplications();
- break;
- }
- return deployments;
- }
-
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- VFSDeployment d = null;
- switch( phase )
- {
- case BOOTSTRAP:
- d = this.removeBootstrap(name);
- break;
- case DEPLOYER:
- d = this.removeDeployer(name);
- break;
- case APPLICATION:
- d = this.removeApplication(name);
- break;
- }
- return d;
- }
-
- public Map<String, Object> getConfig()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected void addBootstrap(VFSDeployment d)
- {
- bootstraps.put(d.getName(), d);
- }
-
- protected VFSDeployment removeBootstrap(String name)
- {
- return bootstraps.remove(name);
- }
-
- protected VFSDeployment getBootstrap(String name)
- {
- return bootstraps.get(name);
- }
-
- protected Collection<VFSDeployment> getBootstraps()
- {
- return Collections.unmodifiableCollection(bootstraps.values());
- }
-
- protected void addDeployer(VFSDeployment d)
- {
- deployers.put(d.getName(), d);
- }
-
- protected VFSDeployment removeDeployer(String name)
- {
- return deployers.remove(name);
- }
-
- protected VFSDeployment getDeployer(String name)
- {
- return deployers.get(name);
- }
-
- protected Collection<VFSDeployment> getDeployers()
- {
- return Collections.unmodifiableCollection(deployers.values());
- }
-
- protected void addApplication(VFSDeployment d)
- {
- applications.put(d.getName(), d);
- }
-
- protected VFSDeployment removeApplication(String name)
- {
- return applications.remove(name);
- }
-
- protected VFSDeployment getApplication(String name)
- {
- return applications.get(name);
- }
-
- protected Collection<VFSDeployment> getApplications()
- {
- return Collections.unmodifiableCollection(applications.values());
- }
-
- private void addDeployments(List<VirtualFile> list, VirtualFile root)
- throws Exception
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile component : components)
- {
- String key = component.toURI().toString();
- if( applications.containsKey(key) == true )
- continue;
-
- if (component.isLeaf())
- {
- list.add(component);
- }
- else if (component.getName().indexOf('.') == -1)
- {
- // recurse if not '.' in name and recursive search is enabled
- addDeployments(list, component);
- }
- else
- {
- list.add(component);
- }
- }
- }
-
-}
+/*
+ * 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.server.profile.basic;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
+import org.jboss.system.server.profileservice.VFSScanner;
+import org.jboss.util.JBossObject;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A basic profile implementation that uses in memory store for the applications.
+ * This has to be populated by some other components.
+ *
+ * @see VFSScanner and subclasses for an example usage.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class ProfileImpl extends JBossObject implements Profile
+{
+ /** The deployment factory */
+ private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+
+ private ProfileKey key;
+ /** The directory containing the profiles */
+ private File profileRoot;
+ private LinkedHashMap<String, VFSDeployment> bootstraps = new LinkedHashMap<String, VFSDeployment>();
+ private LinkedHashMap<String, VFSDeployment> applications = new LinkedHashMap<String, VFSDeployment>();
+ private LinkedHashMap<String, VFSDeployment> deployers = new LinkedHashMap<String, VFSDeployment>();
+ /** Is hot deployment checking enabled */
+ private volatile boolean hotdeployEnabled;
+ /** The last time the profile was modified */
+ private long lastModified;
+
+ public ProfileImpl(String profileRoot, ProfileKey key)
+ {
+ this.key = key;
+ this.profileRoot = new File(profileRoot);
+ log.info("Using profile root:"+this.profileRoot.getAbsolutePath());
+ }
+
+ public String getName()
+ {
+ return key.getName();
+ }
+
+ public ProfileKey getKey()
+ {
+ return key;
+ }
+
+ public String getVersion()
+ {
+ return null;
+ }
+
+
+ public long getLastModified()
+ {
+ return this.lastModified;
+ }
+
+ /**
+ * Get the names of the applications in the profile
+ * @return names of applications
+ */
+ public Set<String> getDeploymentNames()
+ {
+ HashSet<String> names = new HashSet<String>();
+ names.addAll(this.bootstraps.keySet());
+ names.addAll(this.deployers.keySet());
+ names.addAll(this.applications.keySet());
+ return names;
+ }
+
+ public VirtualFile getRootFile(DeploymentPhase phase)
+ throws Exception
+ {
+ VirtualFile root = VFS.getRoot(profileRoot.toURI());
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ root = root.findChild("conf");
+ break;
+ case DEPLOYER:
+ root = root.findChild("deployers");
+ break;
+ case APPLICATION:
+ root = root.findChild("deploy");
+ break;
+ }
+ return root;
+ }
+
+ public void addDeployment(VFSDeployment d, DeploymentPhase phase)
+ throws Exception
+ {
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ this.addBootstrap(d);
+ break;
+ case DEPLOYER:
+ this.addDeployer(d);
+ break;
+ case APPLICATION:
+ this.addApplication(d);
+ break;
+ }
+ this.lastModified = System.currentTimeMillis();
+ }
+ public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
+ Map<String, Object> attachments)
+ throws Exception
+ {
+
+ }
+
+ /**
+ * Find a deployment context from the basic profile service.
+ *
+ * @param name the name of the deployment
+ * @param phase optionally a deployment phase, if null search all
+ * @return the deployment or null if not found
+ */
+ private VFSDeployment findDeployment(String name, DeploymentPhase phase)
+ {
+ VFSDeployment d = null;
+ if( phase == null )
+ {
+ // Try all phases
+ d = this.getBootstrap(name);
+ if( d == null )
+ d = this.getDeployer(name);
+ if( d == null )
+ d = this.getApplication(name);
+ }
+ else
+ {
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ d = this.getBootstrap(name);
+ break;
+ case DEPLOYER:
+ d = this.getDeployer(name);
+ break;
+ case APPLICATION:
+ d = this.getApplication(name);
+ break;
+ }
+ }
+ return d;
+ }
+
+ /**
+ * Get a deployment context from the basic profile service.
+ *
+ * @param name the name of the deployment
+ * @param phase optionally a deployment phase, if null search all
+ * @return the deployment or NoSuchDeploymentException
+ * @throws NoSuchDeploymentException if the deployment can't be found
+ */
+ public VFSDeployment getDeployment(String name, DeploymentPhase phase)
+ throws NoSuchDeploymentException
+ {
+ VFSDeployment d = findDeployment(name, phase);
+ // Make sure we don't return null
+ if( d == null )
+ throw new NoSuchDeploymentException("name="+name+", phase="+phase);
+ return d;
+ }
+
+ /**
+ * Checks whether a deployment context is available in the basic profile service.
+ *
+ * @param name the name of the deployment
+ * @param phase optionally a deployment phase, if null search all
+ * @return true if the deployment is found or false otherwise
+ */
+ public boolean hasDeployment(String name, DeploymentPhase phase)
+ {
+ return findDeployment(name, phase) != null;
+ }
+
+ public Set<String> getDeploymentNames(DeploymentPhase phase)
+ {
+ HashSet<String> names = new HashSet<String>();
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ names.addAll(this.bootstraps.keySet());
+ break;
+ case DEPLOYER:
+ names.addAll(this.deployers.keySet());
+ break;
+ case APPLICATION:
+ names.addAll(this.applications.keySet());
+ break;
+ }
+ return names;
+ }
+
+ public Set<String> getDeploymentNamesForType(String type)
+ {
+ throw new UnsupportedOperationException("getDeploymentNamesForType");
+ /** TODO Deployment.getTypes()
+ HashSet<String> names = new HashSet<String>();
+ for(VFSDeployment d : bootstraps.values())
+ {
+ if( d.getTypes().contains(type) )
+ names.add(d.getName());
+ }
+ for(VFSDeployment d : deployers.values())
+ {
+ if( d.getTypes().contains(type) )
+ names.add(d.getName());
+ }
+ for(VFSDeployment d : applications.values())
+ {
+ if( d.getTypes().contains(type) )
+ names.add(d.getName());
+ }
+ return names;
+ */
+ }
+
+ public Collection<VFSDeployment> getDeployments()
+ {
+ HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
+ deployments.addAll(this.bootstraps.values());
+ deployments.addAll(this.deployers.values());
+ deployments.addAll(this.applications.values());
+ return Collections.unmodifiableCollection(deployments);
+ }
+
+ /**
+ * Go through the applications looking for modifications. This also
+ * picks the last application parent directory as the basis for
+ * scanning for new deployments.
+ * TODO: to handle multiple application/hotdeployment directories a
+ * set of parent dirs needs to be built.
+ */
+ public Collection<ModificationInfo> getModifiedDeployments()
+ throws Exception
+ {
+ if( hotdeployEnabled == false )
+ return Collections.emptyList();
+
+ ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
+ Collection<VFSDeployment> apps = applications.values();
+ boolean trace = log.isTraceEnabled();
+ if( trace )
+ log.trace("Checking applications for modifications");
+ VirtualFile applicationDir = null;
+ if( apps != null )
+ {
+ Iterator<VFSDeployment> iter = apps.iterator();
+ while( iter.hasNext() )
+ {
+ VFSDeployment d = iter.next();
+ VirtualFile root = d.getRoot();
+ // Save the containing parent dir to scan for new deployments
+ VirtualFile parent = root.getParent();
+ if(parent != null && (applicationDir == null || parent.getPathName().compareTo(applicationDir.getPathName()) < 0 ))
+ applicationDir = parent;
+ // Check for removal
+ if( root.exists() == false )
+ {
+ long rootLastModified = root.getLastModified();
+ ModificationInfo info = new ModificationInfo(d, rootLastModified, ModifyStatus.REMOVED);
+ modified.add(info);
+ iter.remove();
+ if( trace )
+ log.trace(root.getPathName() + " was removed");
+ postRemove(d);
+ }
+ // Check for modification
+ else if(hasBeenModified(root))
+ {
+ long rootLastModified = root.getLastModified();
+ if( trace )
+ log.trace(root.getPathName() + " was modified: " + rootLastModified);
+ // Need to create a duplicate ctx
+ VFSDeployment deployment2 = deploymentFactory.createVFSDeployment(root);
+ ModificationInfo info = new ModificationInfo(deployment2, rootLastModified, ModifyStatus.MODIFIED);
+ modified.add(info);
+ }
+ // TODO: this could check metadata files modifications as well
+ }
+
+ // If there are no apps, use the default appplication root
+ if( applicationDir == null )
+ applicationDir = getRootFile(DeploymentPhase.APPLICATION);
+ // Now check for additions
+ ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+ addDeployments(added, applicationDir);
+ for(VirtualFile vf : added)
+ {
+ VFSDeployment d = deploymentFactory.createVFSDeployment(vf);
+ ModificationInfo info = new ModificationInfo(d, vf.getLastModified(), ModifyStatus.ADDED);
+ modified.add(info);
+ applications.put(d.getName(), d);
+ }
+ }
+ if(modified.size() > 0)
+ lastModified = System.currentTimeMillis();
+ return modified;
+ }
+
+ /**
+ * Has the root been modified.
+ *
+ * @param root the virtual file root
+ * @return true if modifed
+ * @throws Exception for any error
+ */
+ protected boolean hasBeenModified(VirtualFile root) throws Exception
+ {
+ return root.hasBeenModified();
+ }
+
+ /**
+ * Apply post remove operation.
+ *
+ * @param deployment the vfs deployment
+ * @throws Exception for any error
+ */
+ protected void postRemove(VFSDeployment deployment) throws Exception
+ {
+ // noop here
+ }
+
+ /**
+ * Noop as basic profile does not support hot deployment currently
+ */
+ public void enableModifiedDeploymentChecks(boolean flag)
+ {
+ this.hotdeployEnabled = flag;
+ }
+
+ public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
+ {
+ Collection<VFSDeployment> deployments = null;
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ deployments = this.getBootstraps();
+ break;
+ case DEPLOYER:
+ deployments = this.getDeployers();
+ break;
+ case APPLICATION:
+ deployments = this.getApplications();
+ break;
+ }
+ return deployments;
+ }
+
+ public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
+ throws Exception
+ {
+ VFSDeployment d = null;
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ d = this.removeBootstrap(name);
+ break;
+ case DEPLOYER:
+ d = this.removeDeployer(name);
+ break;
+ case APPLICATION:
+ d = this.removeApplication(name);
+ break;
+ }
+ return d;
+ }
+
+ public Map<String, Object> getConfig()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ protected void addBootstrap(VFSDeployment d)
+ {
+ bootstraps.put(d.getName(), d);
+ }
+
+ protected VFSDeployment removeBootstrap(String name)
+ {
+ return bootstraps.remove(name);
+ }
+
+ protected VFSDeployment getBootstrap(String name)
+ {
+ return bootstraps.get(name);
+ }
+
+ protected Collection<VFSDeployment> getBootstraps()
+ {
+ return Collections.unmodifiableCollection(bootstraps.values());
+ }
+
+ protected void addDeployer(VFSDeployment d)
+ {
+ deployers.put(d.getName(), d);
+ }
+
+ protected VFSDeployment removeDeployer(String name)
+ {
+ return deployers.remove(name);
+ }
+
+ protected VFSDeployment getDeployer(String name)
+ {
+ return deployers.get(name);
+ }
+
+ protected Collection<VFSDeployment> getDeployers()
+ {
+ return Collections.unmodifiableCollection(deployers.values());
+ }
+
+ protected void addApplication(VFSDeployment d)
+ {
+ applications.put(d.getName(), d);
+ }
+
+ protected VFSDeployment removeApplication(String name)
+ {
+ return applications.remove(name);
+ }
+
+ protected VFSDeployment getApplication(String name)
+ {
+ return applications.get(name);
+ }
+
+ protected Collection<VFSDeployment> getApplications()
+ {
+ return Collections.unmodifiableCollection(applications.values());
+ }
+
+ private void addDeployments(List<VirtualFile> list, VirtualFile root)
+ throws Exception
+ {
+ List<VirtualFile> components = root.getChildren();
+
+ for (VirtualFile component : components)
+ {
+ String key = component.toURI().toString();
+ if( applications.containsKey(key) == true )
+ continue;
+
+ if (component.isLeaf())
+ {
+ list.add(component);
+ }
+ else if (component.getName().indexOf('.') == -1)
+ {
+ // recurse if not '.' in name and recursive search is enabled
+ addDeployments(list, component);
+ }
+ else
+ {
+ list.add(component);
+ }
+ }
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,38 +1,38 @@
-/*
- * 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.server.profile.basic;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Include only .xml files.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class XmlIncludeVirtualFileFilter implements VirtualFileFilter
-{
- public boolean accepts(VirtualFile file)
- {
- return file.getName().endsWith(".xml");
- }
+/*
+ * 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.server.profile.basic;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Include only .xml files.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class XmlIncludeVirtualFileFilter implements VirtualFileFilter
+{
+ public boolean accepts(VirtualFile file)
+ {
+ return file.getName().endsWith(".xml");
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,197 +1,197 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profile.repository;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A profile implementation that uses the DeploymentRepository to store
- * deployments and admin metadata.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class ProfileImpl extends JBossObject
- implements Profile
-{
- private ProfileKey key;
- private String version;
- /** The repository containing the deployment contents */
- private DeploymentRepository repository;
- /** Is hot deployment checking enabled */
- private volatile boolean hotdeployEnabled;
-
- /**
- *
- * @param repository the repository
- * @param key the key
- */
- public ProfileImpl(DeploymentRepository repository, ProfileKey key)
- {
- this.key = key;
- this.repository = repository;
- log.info("Using repository:"+repository);
- }
-
- public String getName()
- {
- return key.getName();
- }
-
- public ProfileKey getKey()
- {
- return key;
- }
-
- public String getVersion()
- {
- return version;
- }
-
-
- public long getLastModified()
- {
- return repository.getLastModified();
- }
-
- /**
- * Get the names of the deployments in the profile
- * @return names of deployments
- */
- public Set<String> getDeploymentNames()
- {
- return repository.getDeploymentNames();
- }
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- return repository.getDeploymentNames(phase);
- }
-
- public VirtualFile getRootFile(DeploymentPhase phase)
- throws Exception
- {
- URI uri = repository.getDeploymentURI(phase);
- return VFS.getRoot(uri);
- }
-
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- throws Exception
- {
- return repository.getDeployments(phase);
- }
- public Collection<VFSDeployment> getDeployments()
- throws Exception
- {
- return repository.getDeployments();
- }
-
- /**
- *
- */
- public Collection<ModificationInfo> getModifiedDeployments()
- throws Exception
- {
- Collection<ModificationInfo> modified = Collections.emptyList();
- if( hotdeployEnabled == true )
- modified = repository.getModifiedDeployments();
- return modified;
- }
- /**
- * Enable/disable getModifiedDeployments results.
- */
- public synchronized void enableModifiedDeploymentChecks(boolean flag)
- {
- this.hotdeployEnabled = flag;
- }
-
- public void addDeployment(VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- String name = d.getName();
- repository.addDeployment(name, d, phase);
- }
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- Map<String, Object> attachments)
- throws Exception
- {
- repository.updateDeployment(d, phase, attachments);
- }
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws Exception, NoSuchDeploymentException
- {
- return repository.getDeployment(name, phase);
- }
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- return repository.removeDeployment(name, phase);
- }
-
- public Map<String, Object> getConfig()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean hasDeployment(String name, DeploymentPhase phase)
- {
- // TODO: Wolf: needs refactoring / review
- try
- {
- getDeployment(name, phase);
- return true;
- }
- catch(NoSuchDeploymentException e)
- {
- return false;
- }
- catch(Exception e)
- {
- log.warn("getDeployment return exception", e);
- return false;
- }
- }
-
- @Override
- protected void toString(JBossStringBuilder buffer)
- {
- buffer.append("key=");
- buffer.append(this.key);
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profile.repository;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A profile implementation that uses the DeploymentRepository to store
+ * deployments and admin metadata.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ProfileImpl extends JBossObject
+ implements Profile
+{
+ private ProfileKey key;
+ private String version;
+ /** The repository containing the deployment contents */
+ private DeploymentRepository repository;
+ /** Is hot deployment checking enabled */
+ private volatile boolean hotdeployEnabled;
+
+ /**
+ *
+ * @param repository the repository
+ * @param key the key
+ */
+ public ProfileImpl(DeploymentRepository repository, ProfileKey key)
+ {
+ this.key = key;
+ this.repository = repository;
+ log.info("Using repository:"+repository);
+ }
+
+ public String getName()
+ {
+ return key.getName();
+ }
+
+ public ProfileKey getKey()
+ {
+ return key;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+
+ public long getLastModified()
+ {
+ return repository.getLastModified();
+ }
+
+ /**
+ * Get the names of the deployments in the profile
+ * @return names of deployments
+ */
+ public Set<String> getDeploymentNames()
+ {
+ return repository.getDeploymentNames();
+ }
+ public Set<String> getDeploymentNames(DeploymentPhase phase)
+ {
+ return repository.getDeploymentNames(phase);
+ }
+
+ public VirtualFile getRootFile(DeploymentPhase phase)
+ throws Exception
+ {
+ URI uri = repository.getDeploymentURI(phase);
+ return VFS.getRoot(uri);
+ }
+
+ public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
+ throws Exception
+ {
+ return repository.getDeployments(phase);
+ }
+ public Collection<VFSDeployment> getDeployments()
+ throws Exception
+ {
+ return repository.getDeployments();
+ }
+
+ /**
+ *
+ */
+ public Collection<ModificationInfo> getModifiedDeployments()
+ throws Exception
+ {
+ Collection<ModificationInfo> modified = Collections.emptyList();
+ if( hotdeployEnabled == true )
+ modified = repository.getModifiedDeployments();
+ return modified;
+ }
+ /**
+ * Enable/disable getModifiedDeployments results.
+ */
+ public synchronized void enableModifiedDeploymentChecks(boolean flag)
+ {
+ this.hotdeployEnabled = flag;
+ }
+
+ public void addDeployment(VFSDeployment d, DeploymentPhase phase)
+ throws Exception
+ {
+ String name = d.getName();
+ repository.addDeployment(name, d, phase);
+ }
+ public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
+ Map<String, Object> attachments)
+ throws Exception
+ {
+ repository.updateDeployment(d, phase, attachments);
+ }
+ public VFSDeployment getDeployment(String name, DeploymentPhase phase)
+ throws Exception, NoSuchDeploymentException
+ {
+ return repository.getDeployment(name, phase);
+ }
+ public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
+ throws Exception
+ {
+ return repository.removeDeployment(name, phase);
+ }
+
+ public Map<String, Object> getConfig()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean hasDeployment(String name, DeploymentPhase phase)
+ {
+ // TODO: Wolf: needs refactoring / review
+ try
+ {
+ getDeployment(name, phase);
+ return true;
+ }
+ catch(NoSuchDeploymentException e)
+ {
+ return false;
+ }
+ catch(Exception e)
+ {
+ log.warn("getDeployment return exception", e);
+ return false;
+ }
+ }
+
+ @Override
+ protected void toString(JBossStringBuilder buffer)
+ {
+ buffer.append("key=");
+ buffer.append(this.key);
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,57 +1,57 @@
-/*
- * 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.server.profileservice;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.managed.api.ManagedDeployment;
-
-/**
- * DeploymentPhaseScanner.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class DeploymentPhaseVFSScanner extends VFSScanner
-{
- private ManagedDeployment.DeploymentPhase phase;
-
- protected DeploymentPhaseVFSScanner(ManagedDeployment.DeploymentPhase phase)
- {
- if (phase == null)
- throw new IllegalArgumentException("Null deployment phase");
- this.phase = phase;
- }
-
- protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
- {
- VFSDeployment deployment = createDeployment(file);
- if(profile.hasDeployment(deployment.getName(), phase) == false)
- profile.addDeployment(deployment, phase);
- return deployment;
- }
-
- protected void remove(Profile profile, String name) throws Exception
- {
- profile.removeDeployment(name, phase);
- }
-}
+/*
+ * 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.server.profileservice;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.managed.api.ManagedDeployment;
+
+/**
+ * DeploymentPhaseScanner.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class DeploymentPhaseVFSScanner extends VFSScanner
+{
+ private ManagedDeployment.DeploymentPhase phase;
+
+ protected DeploymentPhaseVFSScanner(ManagedDeployment.DeploymentPhase phase)
+ {
+ if (phase == null)
+ throw new IllegalArgumentException("Null deployment phase");
+ this.phase = phase;
+ }
+
+ protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
+ {
+ VFSDeployment deployment = createDeployment(file);
+ if(profile.hasDeployment(deployment.getName(), phase) == false)
+ profile.addDeployment(deployment, phase);
+ return deployment;
+ }
+
+ protected void remove(Profile profile, String name) throws Exception
+ {
+ profile.removeDeployment(name, phase);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,395 +1,395 @@
-/*
- * 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.server.profileservice;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.jboss.bootstrap.spi.Bootstrap;
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.bootstrap.spi.microcontainer.MCServer;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.plugins.main.MainDeployerImpl;
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-
-/**
- * Bootstraps the profile service
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class ProfileServiceBootstrap implements Bootstrap
-{
- /** The log */
- private static final Logger log = Logger.getLogger(ProfileServiceBootstrap.class);
-
- /** The name of the profile that is being booted */
- protected String profileName = "default";
-
- /** The server MainDeployer */
- protected MainDeployer mainDeployer;
-
- /** The server ProfileService */
- protected ProfileService profileService;
-
- /** The kernel */
- protected Kernel kernel;
-
- /** Whether we are shutdown */
- private AtomicBoolean shutdown = new AtomicBoolean(false);
-
- /**
- * Create a new ProfileServiceBootstrap.
- */
- public ProfileServiceBootstrap()
- {
- }
-
- /**
- * Return the MainDeployer bean.
- *
- * @return the MainDeployer bean if bootstrap succeeded, null otherwise.
- */
- public MainDeployer getMainDeployer()
- {
- return mainDeployer;
- }
- public void setMainDeployer(MainDeployer mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Return the ProfileService bean.
- *
- * @return the ProfileService bean if bootstrap succeeded, null otherwise
- */
- public ProfileService getProfileService()
- {
- return profileService;
- }
- public void setProfileService(ProfileService profileService)
- {
- this.profileService = profileService;
- }
-
- /**
- * Get the kernel.
- *
- * @return the kernel.
- */
- public Kernel getKernel()
- {
- return kernel;
- }
-
- /**
- * Set the kernel.
- *
- * @param kernel the kernel.
- */
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- /**
- *
- */
- public void start(Server server)
- throws Exception
- {
- shutdown.set(false);
-
- if(profileService == null)
- throw new IllegalStateException("The ProfileService has not been injected");
- log.debug("Using ProfileService: " + profileService);
- if(profileService == null)
- throw new IllegalStateException("The MainDeployer has not been injected");
- log.debug("Using MainDeployer: " + mainDeployer);
-
- // Validate that everything is ok
- mainDeployer.checkComplete();
-
- // TODO: JBAS-5689 Expose the bootstrap ManagedDeployments...
- Map<String, KernelDeployment> serverDeployments = null;
- if(server instanceof MCServer)
- {
- MCServer mcserver = MCServer.class.cast(server);
- serverDeployments = mcserver.getDeployments();
- }
-
- // Load the profile beans
- try
- {
- loadProfile(profileName);
- }
- catch (IncompleteDeploymentException e)
- {
- log.error("Failed to load profile: " + e.getMessage());
- }
- catch (Exception e)
- {
- log.error("Failed to load profile: ", e);
- }
- // Mark the profile as ready for hotdeployment if supported
- Profile profile = profileService.getActiveProfile();
- if( profile != null )
- profile.enableModifiedDeploymentChecks(true);
- }
-
- public void prepareShutdown(Server server)
- {
- shutdown.set(true);
- if (mainDeployer != null)
- mainDeployer.prepareShutdown();
- }
-
- public void shutdown(Server server)
- {
- unloadProfile(profileName);
- try
- {
- mainDeployer.shutdown();
- }
- catch (Throwable t)
- {
- log.warn("Error shutting down the main deployer", t);
- }
- }
-
- /**
- * Get a bean
- *
- * @param <T> the expected type
- * @param controller the controller
- * @param name the bean name
- * @param expectedType the expected type
- * @return the bean
- * @throws IllegalStateException if the bean is not installed or has the wrong type
- */
- protected <T> T getBean(KernelController controller, Object name, Class<T> expectedType)
- {
- ControllerContext context = controller.getInstalledContext(name);
- if (context == null)
- throw new IllegalStateException("Context not installed: " + name);
- Object result = context.getTarget();
- if (result == null)
- throw new IllegalStateException("No target for " + name);
- if (expectedType.isInstance(result) == false)
- throw new IllegalStateException(name + " expected " + expectedType.getName() + " was " + result.getClass().getName());
- return expectedType.cast(result);
- }
-
- /**
- * Load the deployments associated with the named profile and deploy them
- * using the MainDeployer.
- *
- * @param name
- * @throws Exception for any error
- * @throws NullPointerException if either the MainDeployer or ProfileService
- * have not been injected.
- */
- protected void loadProfile(String name) throws Exception
- {
- MainDeployer deployer = getMainDeployer();
- if (deployer == null)
- throw new NullPointerException("MainDeployer has not been set");
- ProfileService ps = getProfileService();
- if (ps == null)
- throw new NullPointerException("ProfileService has not been set");
-
- // Load the named profile
- ProfileKey key = new ProfileKey(name);
- Profile profile = ps.getProfile(key);
-
- // HACK
- VFSDeployment first = null;
-
- // Deploy the bootstrap
- Collection<VFSDeployment> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
- for (VFSDeployment d : boostraps)
- {
- deployer.addDeployment(d);
- if (first == null)
- first = d;
- }
- deployer.process();
- deployer.checkComplete();
-
- Thread thread = Thread.currentThread();
- ClassLoader old = thread.getContextClassLoader();
- // FIXME remove this hack
- MainDeployerImpl hack = (MainDeployerImpl) deployer;
- ClassLoader cl = null;
- if (first != null)
- {
- DeploymentContext ctx = hack.getDeploymentContext(first.getName());
- if (ctx != null)
- cl = ctx.getClassLoader();
- }
- //if (cl != null)
- // thread.setContextClassLoader(cl);
- try
- {
-
- // Deploy the profile deployers
- Collection<VFSDeployment> profileDeployers = profile.getDeployments(DeploymentPhase.DEPLOYER);
- for (VFSDeployment d : profileDeployers)
- deployer.addDeployment(d);
- deployer.process();
- deployer.checkComplete();
-
- // Deploy the profile applications
- Collection<VFSDeployment> profileDeployments = profile.getDeployments(DeploymentPhase.APPLICATION);
- for (VFSDeployment d : profileDeployments)
- deployer.addDeployment(d);
- deployer.process();
- deployer.checkComplete();
- }
- finally
- {
- thread.setContextClassLoader(old);
- }
- }
-
- /**
- * Unload the deployments associated with the named profile and undeploy them
- * using the MainDeployer in reverse phase order.
- *
- * @param name the profile name
- * @throws NullPointerException if either the MainDeployer or ProfileService
- * have not been injected.
- */
- protected void unloadProfile(String name)
- {
- MainDeployer deployer = getMainDeployer();
- if (deployer == null)
- {
- log.warn("MainDeployer has not been set");
- return;
- }
- ProfileService ps = getProfileService();
- if (ps == null)
- {
- log.warn("ProfileService has not been set");
- return;
- }
-
- try
- {
- // Load the named profile
- ProfileKey key = new ProfileKey(name);
- Profile profile = ps.getProfile(key);
-
- // HACK
- VFSDeployment first = null;
-
- // Deploy the bootstrap
- Collection<VFSDeployment> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
- for (VFSDeployment d : boostraps)
- {
- if (first == null)
- {
- first = d;
- break;
- }
- }
-
- Thread thread = Thread.currentThread();
- ClassLoader old = thread.getContextClassLoader();
- // FIXME remove this hack
- MainDeployerImpl hack = (MainDeployerImpl) deployer;
- ClassLoader cl = null;
- if (first != null)
- {
- try
- {
- DeploymentContext ctx = hack.getDeploymentContext(first.getName());
- if (ctx != null)
- cl = ctx.getClassLoader();
- }
- catch (Exception e)
- {
- log.debug("Unable to get first deployment", e);
- }
- }
- //if (cl != null)
- // thread.setContextClassLoader(cl);
- try
- {
- // Undeploy the applications
- unload(deployer, profile.getDeployments(DeploymentPhase.APPLICATION));
- // Undeploy the deployers
- unload(deployer, profile.getDeployments(DeploymentPhase.DEPLOYER));
- // Undeploy the bootstrap
- unload(deployer, profile.getDeployments(DeploymentPhase.BOOTSTRAP));
- }
- finally
- {
- thread.setContextClassLoader(old);
- }
- }
- catch (Throwable t)
- {
- log.warn("Error unloading profile", t);
- }
- }
-
- /**
- * Unload a set of deployments
- *
- * @param deployer the main deployer
- * @param deployments the deployments
- */
- protected void unload(MainDeployer deployer, Collection<VFSDeployment> deployments)
- {
- if (deployments == null || deployments.isEmpty())
- return;
-
- for (VFSDeployment d : deployments)
- {
- try
- {
- deployer.removeDeployment(d);
- }
- catch (Exception e)
- {
- log.warn("Unable to remove deployment: " + d);
- }
- }
- deployer.process();
- }
-}
+/*
+ * 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.server.profileservice;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.jboss.bootstrap.spi.Bootstrap;
+import org.jboss.bootstrap.spi.Server;
+import org.jboss.bootstrap.spi.microcontainer.MCServer;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+
+/**
+ * Bootstraps the profile service
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class ProfileServiceBootstrap implements Bootstrap
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(ProfileServiceBootstrap.class);
+
+ /** The name of the profile that is being booted */
+ protected String profileName = "default";
+
+ /** The server MainDeployer */
+ protected MainDeployer mainDeployer;
+
+ /** The server ProfileService */
+ protected ProfileService profileService;
+
+ /** The kernel */
+ protected Kernel kernel;
+
+ /** Whether we are shutdown */
+ private AtomicBoolean shutdown = new AtomicBoolean(false);
+
+ /**
+ * Create a new ProfileServiceBootstrap.
+ */
+ public ProfileServiceBootstrap()
+ {
+ }
+
+ /**
+ * Return the MainDeployer bean.
+ *
+ * @return the MainDeployer bean if bootstrap succeeded, null otherwise.
+ */
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Return the ProfileService bean.
+ *
+ * @return the ProfileService bean if bootstrap succeeded, null otherwise
+ */
+ public ProfileService getProfileService()
+ {
+ return profileService;
+ }
+ public void setProfileService(ProfileService profileService)
+ {
+ this.profileService = profileService;
+ }
+
+ /**
+ * Get the kernel.
+ *
+ * @return the kernel.
+ */
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ /**
+ * Set the kernel.
+ *
+ * @param kernel the kernel.
+ */
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ /**
+ *
+ */
+ public void start(Server server)
+ throws Exception
+ {
+ shutdown.set(false);
+
+ if(profileService == null)
+ throw new IllegalStateException("The ProfileService has not been injected");
+ log.debug("Using ProfileService: " + profileService);
+ if(profileService == null)
+ throw new IllegalStateException("The MainDeployer has not been injected");
+ log.debug("Using MainDeployer: " + mainDeployer);
+
+ // Validate that everything is ok
+ mainDeployer.checkComplete();
+
+ // TODO: JBAS-5689 Expose the bootstrap ManagedDeployments...
+ Map<String, KernelDeployment> serverDeployments = null;
+ if(server instanceof MCServer)
+ {
+ MCServer mcserver = MCServer.class.cast(server);
+ serverDeployments = mcserver.getDeployments();
+ }
+
+ // Load the profile beans
+ try
+ {
+ loadProfile(profileName);
+ }
+ catch (IncompleteDeploymentException e)
+ {
+ log.error("Failed to load profile: " + e.getMessage());
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to load profile: ", e);
+ }
+ // Mark the profile as ready for hotdeployment if supported
+ Profile profile = profileService.getActiveProfile();
+ if( profile != null )
+ profile.enableModifiedDeploymentChecks(true);
+ }
+
+ public void prepareShutdown(Server server)
+ {
+ shutdown.set(true);
+ if (mainDeployer != null)
+ mainDeployer.prepareShutdown();
+ }
+
+ public void shutdown(Server server)
+ {
+ unloadProfile(profileName);
+ try
+ {
+ mainDeployer.shutdown();
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error shutting down the main deployer", t);
+ }
+ }
+
+ /**
+ * Get a bean
+ *
+ * @param <T> the expected type
+ * @param controller the controller
+ * @param name the bean name
+ * @param expectedType the expected type
+ * @return the bean
+ * @throws IllegalStateException if the bean is not installed or has the wrong type
+ */
+ protected <T> T getBean(KernelController controller, Object name, Class<T> expectedType)
+ {
+ ControllerContext context = controller.getInstalledContext(name);
+ if (context == null)
+ throw new IllegalStateException("Context not installed: " + name);
+ Object result = context.getTarget();
+ if (result == null)
+ throw new IllegalStateException("No target for " + name);
+ if (expectedType.isInstance(result) == false)
+ throw new IllegalStateException(name + " expected " + expectedType.getName() + " was " + result.getClass().getName());
+ return expectedType.cast(result);
+ }
+
+ /**
+ * Load the deployments associated with the named profile and deploy them
+ * using the MainDeployer.
+ *
+ * @param name
+ * @throws Exception for any error
+ * @throws NullPointerException if either the MainDeployer or ProfileService
+ * have not been injected.
+ */
+ protected void loadProfile(String name) throws Exception
+ {
+ MainDeployer deployer = getMainDeployer();
+ if (deployer == null)
+ throw new NullPointerException("MainDeployer has not been set");
+ ProfileService ps = getProfileService();
+ if (ps == null)
+ throw new NullPointerException("ProfileService has not been set");
+
+ // Load the named profile
+ ProfileKey key = new ProfileKey(name);
+ Profile profile = ps.getProfile(key);
+
+ // HACK
+ VFSDeployment first = null;
+
+ // Deploy the bootstrap
+ Collection<VFSDeployment> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
+ for (VFSDeployment d : boostraps)
+ {
+ deployer.addDeployment(d);
+ if (first == null)
+ first = d;
+ }
+ deployer.process();
+ deployer.checkComplete();
+
+ Thread thread = Thread.currentThread();
+ ClassLoader old = thread.getContextClassLoader();
+ // FIXME remove this hack
+ MainDeployerImpl hack = (MainDeployerImpl) deployer;
+ ClassLoader cl = null;
+ if (first != null)
+ {
+ DeploymentContext ctx = hack.getDeploymentContext(first.getName());
+ if (ctx != null)
+ cl = ctx.getClassLoader();
+ }
+ //if (cl != null)
+ // thread.setContextClassLoader(cl);
+ try
+ {
+
+ // Deploy the profile deployers
+ Collection<VFSDeployment> profileDeployers = profile.getDeployments(DeploymentPhase.DEPLOYER);
+ for (VFSDeployment d : profileDeployers)
+ deployer.addDeployment(d);
+ deployer.process();
+ deployer.checkComplete();
+
+ // Deploy the profile applications
+ Collection<VFSDeployment> profileDeployments = profile.getDeployments(DeploymentPhase.APPLICATION);
+ for (VFSDeployment d : profileDeployments)
+ deployer.addDeployment(d);
+ deployer.process();
+ deployer.checkComplete();
+ }
+ finally
+ {
+ thread.setContextClassLoader(old);
+ }
+ }
+
+ /**
+ * Unload the deployments associated with the named profile and undeploy them
+ * using the MainDeployer in reverse phase order.
+ *
+ * @param name the profile name
+ * @throws NullPointerException if either the MainDeployer or ProfileService
+ * have not been injected.
+ */
+ protected void unloadProfile(String name)
+ {
+ MainDeployer deployer = getMainDeployer();
+ if (deployer == null)
+ {
+ log.warn("MainDeployer has not been set");
+ return;
+ }
+ ProfileService ps = getProfileService();
+ if (ps == null)
+ {
+ log.warn("ProfileService has not been set");
+ return;
+ }
+
+ try
+ {
+ // Load the named profile
+ ProfileKey key = new ProfileKey(name);
+ Profile profile = ps.getProfile(key);
+
+ // HACK
+ VFSDeployment first = null;
+
+ // Deploy the bootstrap
+ Collection<VFSDeployment> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
+ for (VFSDeployment d : boostraps)
+ {
+ if (first == null)
+ {
+ first = d;
+ break;
+ }
+ }
+
+ Thread thread = Thread.currentThread();
+ ClassLoader old = thread.getContextClassLoader();
+ // FIXME remove this hack
+ MainDeployerImpl hack = (MainDeployerImpl) deployer;
+ ClassLoader cl = null;
+ if (first != null)
+ {
+ try
+ {
+ DeploymentContext ctx = hack.getDeploymentContext(first.getName());
+ if (ctx != null)
+ cl = ctx.getClassLoader();
+ }
+ catch (Exception e)
+ {
+ log.debug("Unable to get first deployment", e);
+ }
+ }
+ //if (cl != null)
+ // thread.setContextClassLoader(cl);
+ try
+ {
+ // Undeploy the applications
+ unload(deployer, profile.getDeployments(DeploymentPhase.APPLICATION));
+ // Undeploy the deployers
+ unload(deployer, profile.getDeployments(DeploymentPhase.DEPLOYER));
+ // Undeploy the bootstrap
+ unload(deployer, profile.getDeployments(DeploymentPhase.BOOTSTRAP));
+ }
+ finally
+ {
+ thread.setContextClassLoader(old);
+ }
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error unloading profile", t);
+ }
+ }
+
+ /**
+ * Unload a set of deployments
+ *
+ * @param deployer the main deployer
+ * @param deployments the deployments
+ */
+ protected void unload(MainDeployer deployer, Collection<VFSDeployment> deployments)
+ {
+ if (deployments == null || deployments.isEmpty())
+ return;
+
+ for (VFSDeployment d : deployments)
+ {
+ try
+ {
+ deployer.removeDeployment(d);
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to remove deployment: " + d);
+ }
+ }
+ deployer.process();
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,46 +1,46 @@
-/*
- * 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.server.profileservice;
-
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-
-/**
- * Package privileged actions.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-class SecurityActions
-{
- static String getSystemProperty(final String name, final String defaultValue)
- {
- PrivilegedAction<String> action = new PrivilegedAction<String>()
- {
- public String run()
- {
- return System.getProperty(name, defaultValue);
- }
- };
- return AccessController.doPrivileged(action);
- }
-}
+/*
+ * 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.server.profileservice;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+/**
+ * Package privileged actions.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+class SecurityActions
+{
+ static String getSystemProperty(final String name, final String defaultValue)
+ {
+ PrivilegedAction<String> action = new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,38 +1,38 @@
-/*
- * 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.server.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * VFSBootstrapScannerImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSBootstrapScannerImpl extends DeploymentPhaseVFSScanner
-{
- public VFSBootstrapScannerImpl()
- {
- super(DeploymentPhase.BOOTSTRAP);
- }
-}
+/*
+ * 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.server.profileservice;
+
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+
+/**
+ * VFSBootstrapScannerImpl.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSBootstrapScannerImpl extends DeploymentPhaseVFSScanner
+{
+ public VFSBootstrapScannerImpl()
+ {
+ super(DeploymentPhase.BOOTSTRAP);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,38 +1,38 @@
-/*
- * 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.server.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * VFSDeployerScannerImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSDeployerScannerImpl extends DeploymentPhaseVFSScanner
-{
- public VFSDeployerScannerImpl()
- {
- super(DeploymentPhase.DEPLOYER);
- }
-}
+/*
+ * 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.server.profileservice;
+
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+
+/**
+ * VFSDeployerScannerImpl.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSDeployerScannerImpl extends DeploymentPhaseVFSScanner
+{
+ public VFSDeployerScannerImpl()
+ {
+ super(DeploymentPhase.DEPLOYER);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,39 +1,39 @@
-/*
- * 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.server.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * VFSDeploymentScannerImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSDeploymentScannerImpl extends DeploymentPhaseVFSScanner
-{
- public VFSDeploymentScannerImpl()
- {
- super(DeploymentPhase.APPLICATION);
- }
-}
-
+/*
+ * 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.server.profileservice;
+
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+
+/**
+ * VFSDeploymentScannerImpl.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSDeploymentScannerImpl extends DeploymentPhaseVFSScanner
+{
+ public VFSDeploymentScannerImpl()
+ {
+ super(DeploymentPhase.APPLICATION);
+ }
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,590 +1,590 @@
-/*
- * 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.server.profileservice;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.util.JBossObject;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * A DeploymentScanner build on top of the VFS and ProfileService. This is a
- * first pass to flesh out the APIs/concepts.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public abstract class VFSScanner extends JBossObject
-{
- /** The profile service */
- private ProfileService profileService;
-
- /** The profile service key */
- private ProfileKey profileKey;
-
- /** The URIfied ServerHomeURL */
- private URI serverHomeURI;
-
- /** The list of URIs to scan */
- private List<URI> uriList = new CopyOnWriteArrayList<URI>();
-
- /** The list of VirtualFiles to scan */
- private List<VirtualFile> vdfList = new CopyOnWriteArrayList<VirtualFile>();
-
- /** Allow a filter for scanned directories */
- private VirtualFileFilter filter;
-
- /** Whether to search for files inside directories whose names containing no dots */
- private boolean doRecursiveSearch = true;
-
- /** A map of deployed virtual files to their names */
- private Map<VirtualFile, String> deployedSet = new ConcurrentHashMap<VirtualFile, String>();
-
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
-
- /**
- * Get the profileKey.
- *
- * @return the profileKey.
- */
- public ProfileKey getProfileKey()
- {
- return profileKey;
- }
-
- /**
- * Set the profileKey.
- *
- * @param profileKey the profileKey.
- */
- public void setProfileKey(ProfileKey profileKey)
- {
- this.profileKey = profileKey;
- }
-
- /**
- * Get the profileService.
- *
- * @return the profileService.
- */
- public ProfileService getProfileService()
- {
- return profileService;
- }
-
- /**
- * Set the profileService.
- *
- * @param profileService the profileService.
- */
- public void setProfileService(ProfileService profileService)
- {
- this.profileService = profileService;
- }
-
- /**
- * Set the uris
- *
- * @param listspec the uris
- * @throws URISyntaxException
- * @throws IOException
- */
- public void setURIs(final String listspec) throws URISyntaxException, IOException
- {
- if (listspec == null)
- {
- throw new NullPointerException("listspec argument cannot be null");
- }
- List<URI> list = new LinkedList<URI>();
-
- StringTokenizer stok = new StringTokenizer(listspec, ",");
- while (stok.hasMoreTokens())
- {
- String urispec = stok.nextToken().trim();
-
- log.debug("Adding URI from spec: " + urispec);
-
- URI uri = makeURI(urispec);
-
- log.debug("URI: " + uri);
-
- list.add(uri);
- }
- setURIList(list);
- }
-
- /**
- * Set the uri list
- *
- * @param list the list
- * @throws IOException
- */
- public void setURIList(final List<URI> list) throws IOException
- {
- if (list == null)
- {
- throw new NullPointerException("list argument cannot be null");
- }
-
- // start out with a fresh list
- uriList.clear();
-
- for(int n = 0; n < list.size(); n ++)
- {
- URI uri = list.get(n);
- if (uri == null)
- {
- throw new IllegalArgumentException("list element["+n+"] is null");
- }
- addURI(uri);
- }
- log.debug("URI list: " + uriList);
- }
-
- /**
- * Get the uri list
- *
- * @return the list
- */
- public List<URI> getURIList()
- {
- return new ArrayList<URI>(uriList);
- }
-
- /**
- * Set whether to do recursive search
- *
- * @param recurse true when recurisve
- */
- public void setRecursiveSearch(boolean recurse)
- {
- doRecursiveSearch = recurse;
- }
-
- /**
- * Get the recursive search
- *
- * @return true when recursive
- */
- public boolean getRecursiveSearch()
- {
- return doRecursiveSearch;
- }
-
- /**
- * Set the filter
- *
- * @param classname the filter class name
- * @throws ClassNotFoundException when the class is not found
- * @throws IllegalAccessException when the class's default constructor is not public
- * @throws InstantiationException when there is an error constructing the class
- */
- @SuppressWarnings("unchecked")
- public void setFilter(String classname)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Class<VirtualFileFilter> filterClass = (Class<VirtualFileFilter>) loader.loadClass(classname);
- filter = filterClass.newInstance();
- }
-
- /**
- * Get the filer
- *
- * @return the filter
- */
- public String getFilter()
- {
- if (filter == null)
- {
- return null;
- }
- return filter.getClass().getName();
- }
-
- /**
- * Set the filter instance
- *
- * @param filter ther filter
- */
- public void setFilterInstance(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
-
- /**
- * Get the filter instance
- *
- * @return the filter
- */
- public VirtualFileFilter getFilterInstance()
- {
- return filter;
- }
-
- /**
- * Add a uri
- *
- * @param uri the uri
- * @throws IOException for an error accessing the uri
- */
- public void addURI(final URI uri) throws IOException
- {
- if (uri == null)
- {
- throw new NullPointerException("uri argument cannot be null");
- }
- if( uriList.add(uri) == true )
- {
- log.debug("Added URI: " + uri);
- VirtualFile vf = getVFforURI(uri);
- vdfList.add(vf);
- }
- }
-
- /**
- * Remove a uri
- *
- * @param uri the uri
- * @throws IOException for an error accessing the uri
- */
- public void removeURI(final URI uri)
- throws IOException
- {
- if (uri == null)
- {
- throw new NullPointerException("uri argument cannot be null");
- }
- VirtualFile vf = getVFforURI(uri);
- vdfList.remove(vf);
- boolean success = uriList.remove(uri);
-
- if (success)
- {
- log.debug("Removed URI: " + uri);
- }
- }
-
- /**
- * Whether it has the uri
- *
- * @param uri the uri
- * @return when the uri is configured
- */
- public boolean hasURI(final URI uri)
- {
- if (uri == null)
- {
- throw new NullPointerException("uri argument cannot be null");
- }
- return uriList.contains(uri);
- }
-
- /**
- * Start the scan
- *
- * @throws Exception for any error
- */
- public void start() throws Exception
- {
- // synchronize uriList and vdfList because only at this point
- // setVirtualFileFactory() injection has been performed
- vdfList.clear();
- for (Iterator<URI> i = uriList.iterator(); i.hasNext(); )
- {
- URI uri = i.next();
- VirtualFile vf = this.getVFforURI(uri);
- vdfList.add(vf);
- }
- if( profileKey == null )
- {
- profileKey = new ProfileKey("default");
- }
- scan();
- }
-
- /**
- * Scan
- *
- * @throws Exception for any error
- */
- public synchronized void scan() throws Exception
- {
- if (vdfList == null)
- {
- throw new IllegalStateException("not initialized");
- }
-
- boolean trace = log.isTraceEnabled();
-
- // Scan for deployments
- if (trace)
- {
- log.trace("Scanning for new deployments");
- }
-
- // VirtualFiles to deploy
- List<VirtualFile> toDeployList = new LinkedList<VirtualFile>();
- synchronized (vdfList)
- {
- for (Iterator i = vdfList.iterator(); i.hasNext();)
- {
- VirtualFile component = (VirtualFile)i.next();
- if (component.isLeaf())
- {
- // treat this as a deployable unit
- toDeployList.add(component);
- }
- else
- {
- // process (possibly recursively) the dir
- addDeployments(toDeployList, component);
- }
- }
- }
-
- if (trace)
- {
- log.trace("toDeployList");
- for (Iterator i = toDeployList.iterator(); i.hasNext();)
- {
- log.trace(i.next());
- }
- }
- LinkedList<VirtualFile> toRemoveList = new LinkedList<VirtualFile>();
-
- synchronized (deployedSet)
- {
- // remove previously deployed URLs no longer needed
- for (VirtualFile deployedComponent : deployedSet.keySet())
- {
- if (toDeployList.contains(deployedComponent) == false)
- {
- toRemoveList.add(deployedComponent);
- }
- }
- }
-
- // ********
- // Undeploy
- // ********
-
- for (Iterator i = toRemoveList.iterator(); i.hasNext();)
- {
- VirtualFile deployedComponent = (VirtualFile)i.next();
- undeploy(deployedComponent);
- }
-
- // ******
- // Deploy
- // ******
-
- for (Iterator i = toDeployList.iterator(); i.hasNext();)
- {
- VirtualFile component = (VirtualFile)i.next();
-
- // if component is not deployed already, deploy it
- if (!deployedSet.containsKey(component))
- {
- deploy(component);
- }
-
- // component must have been deployed by now, so remove it from list
- i.remove();
-
- }
-
- }
-
- /**
- * Make a uri
- *
- * @param urispec the uri spec
- * @return the uri
- * @throws URISyntaxException for an error parsing he uri
- */
- private URI makeURI(String urispec) throws URISyntaxException
- {
- // First replace URI with appropriate properties
- urispec = StringPropertyReplacer.replaceProperties(urispec);
- return serverHomeURI.resolve(urispec);
- }
-
- /**
- * A helper to find all deployments under a directory component
- * and add them to the supplied list.
- *
- * We may recurse.
- *
- * @param list the list of virtual files
- * @param root the root file
- * @throws IOException for any error
- */
- private void addDeployments(List<VirtualFile> list, VirtualFile root)
- throws IOException
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile component : components)
- {
- // Filter the component regardless of its type
- if( filter != null && filter.accepts(component) == false)
- continue;
- if (component.isLeaf())
- {
- list.add(component);
- }
- // TODO replace . in the name with isArchive() == false?
- else if (component.getName().indexOf('.') == -1 && this.doRecursiveSearch)
- {
- // recurse if not '.' in name and recursive search is enabled
- addDeployments(list, component);
- }
- else
- {
- list.add(component);
- }
- }
- }
-
- /**
- * A helper to deploy the given component using the deployer.
- *
- * @param component the virtual file
- */
- private void deploy(final VirtualFile component)
- {
- // If the deployer is null simply ignore the request
- if (profileService == null)
- {
- return;
- }
- if (log.isTraceEnabled())
- {
- log.trace("Deploying: " + component);
- }
-
- VFSDeployment deployment = null;
- try
- {
- Profile profile = profileService.getProfile(profileKey);
- deployment = add(profile, component);
- }
- catch (Exception e)
- {
- log.debug("Failed to deploy: " + component, e);
- }
-
- if (deployment != null && !deployedSet.containsKey(component))
- {
- deployedSet.put(component, deployment.getName());
- }
- }
-
- /**
- * A helper to undeploy the given component using the deployer.
- *
- * @param component the component
- */
- private void undeploy(final VirtualFile component)
- {
- try
- {
- if (log.isTraceEnabled())
- {
- log.trace("Undeploying: " + component);
- }
- String name = deployedSet.remove(component);
- Profile profile = profileService.getProfile(profileKey);
- remove(profile, name);
- }
- catch (Exception e)
- {
- log.error("Failed to undeploy: " + component, e);
- }
- }
-
- /**
- * Remove the component
- *
- * @param profile the profile
- * @param file the virtual file
- * @return the deployment context or null if not added, e.g. it already exists
- * @throws Exception for any error
- */
- protected abstract VFSDeployment add(Profile profile, VirtualFile file) throws Exception;
-
- /**
- * Remove the component
- *
- * @param profile the profile
- * @param name the name
- * @throws Exception for any error
- */
- protected abstract void remove(Profile profile, String name) throws Exception;
-
- /**
- * Create a deployment
- *
- * @param file the root file
- * @return the deployment
- */
- protected VFSDeployment createDeployment(VirtualFile file)
- {
- if (file == null)
- throw new IllegalArgumentException("Null file");
- return deploymentFactory.createVFSDeployment(file);
- }
-
- /**
- * Get virtual file for uri.
- *
- * @param uri the uri
- * @return vritual file representing uri
- * @throws IOException for any error
- */
- private VirtualFile getVFforURI(URI uri) throws IOException
- {
- return VFS.getCachedFile(uri);
- }
-}
+/*
+ * 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.server.profileservice;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.util.JBossObject;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * A DeploymentScanner build on top of the VFS and ProfileService. This is a
+ * first pass to flesh out the APIs/concepts.
+ *
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public abstract class VFSScanner extends JBossObject
+{
+ /** The profile service */
+ private ProfileService profileService;
+
+ /** The profile service key */
+ private ProfileKey profileKey;
+
+ /** The URIfied ServerHomeURL */
+ private URI serverHomeURI;
+
+ /** The list of URIs to scan */
+ private List<URI> uriList = new CopyOnWriteArrayList<URI>();
+
+ /** The list of VirtualFiles to scan */
+ private List<VirtualFile> vdfList = new CopyOnWriteArrayList<VirtualFile>();
+
+ /** Allow a filter for scanned directories */
+ private VirtualFileFilter filter;
+
+ /** Whether to search for files inside directories whose names containing no dots */
+ private boolean doRecursiveSearch = true;
+
+ /** A map of deployed virtual files to their names */
+ private Map<VirtualFile, String> deployedSet = new ConcurrentHashMap<VirtualFile, String>();
+
+ /** The deployment factory */
+ private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+
+ /**
+ * Get the profileKey.
+ *
+ * @return the profileKey.
+ */
+ public ProfileKey getProfileKey()
+ {
+ return profileKey;
+ }
+
+ /**
+ * Set the profileKey.
+ *
+ * @param profileKey the profileKey.
+ */
+ public void setProfileKey(ProfileKey profileKey)
+ {
+ this.profileKey = profileKey;
+ }
+
+ /**
+ * Get the profileService.
+ *
+ * @return the profileService.
+ */
+ public ProfileService getProfileService()
+ {
+ return profileService;
+ }
+
+ /**
+ * Set the profileService.
+ *
+ * @param profileService the profileService.
+ */
+ public void setProfileService(ProfileService profileService)
+ {
+ this.profileService = profileService;
+ }
+
+ /**
+ * Set the uris
+ *
+ * @param listspec the uris
+ * @throws URISyntaxException
+ * @throws IOException
+ */
+ public void setURIs(final String listspec) throws URISyntaxException, IOException
+ {
+ if (listspec == null)
+ {
+ throw new NullPointerException("listspec argument cannot be null");
+ }
+ List<URI> list = new LinkedList<URI>();
+
+ StringTokenizer stok = new StringTokenizer(listspec, ",");
+ while (stok.hasMoreTokens())
+ {
+ String urispec = stok.nextToken().trim();
+
+ log.debug("Adding URI from spec: " + urispec);
+
+ URI uri = makeURI(urispec);
+
+ log.debug("URI: " + uri);
+
+ list.add(uri);
+ }
+ setURIList(list);
+ }
+
+ /**
+ * Set the uri list
+ *
+ * @param list the list
+ * @throws IOException
+ */
+ public void setURIList(final List<URI> list) throws IOException
+ {
+ if (list == null)
+ {
+ throw new NullPointerException("list argument cannot be null");
+ }
+
+ // start out with a fresh list
+ uriList.clear();
+
+ for(int n = 0; n < list.size(); n ++)
+ {
+ URI uri = list.get(n);
+ if (uri == null)
+ {
+ throw new IllegalArgumentException("list element["+n+"] is null");
+ }
+ addURI(uri);
+ }
+ log.debug("URI list: " + uriList);
+ }
+
+ /**
+ * Get the uri list
+ *
+ * @return the list
+ */
+ public List<URI> getURIList()
+ {
+ return new ArrayList<URI>(uriList);
+ }
+
+ /**
+ * Set whether to do recursive search
+ *
+ * @param recurse true when recurisve
+ */
+ public void setRecursiveSearch(boolean recurse)
+ {
+ doRecursiveSearch = recurse;
+ }
+
+ /**
+ * Get the recursive search
+ *
+ * @return true when recursive
+ */
+ public boolean getRecursiveSearch()
+ {
+ return doRecursiveSearch;
+ }
+
+ /**
+ * Set the filter
+ *
+ * @param classname the filter class name
+ * @throws ClassNotFoundException when the class is not found
+ * @throws IllegalAccessException when the class's default constructor is not public
+ * @throws InstantiationException when there is an error constructing the class
+ */
+ @SuppressWarnings("unchecked")
+ public void setFilter(String classname)
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class<VirtualFileFilter> filterClass = (Class<VirtualFileFilter>) loader.loadClass(classname);
+ filter = filterClass.newInstance();
+ }
+
+ /**
+ * Get the filer
+ *
+ * @return the filter
+ */
+ public String getFilter()
+ {
+ if (filter == null)
+ {
+ return null;
+ }
+ return filter.getClass().getName();
+ }
+
+ /**
+ * Set the filter instance
+ *
+ * @param filter ther filter
+ */
+ public void setFilterInstance(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ /**
+ * Get the filter instance
+ *
+ * @return the filter
+ */
+ public VirtualFileFilter getFilterInstance()
+ {
+ return filter;
+ }
+
+ /**
+ * Add a uri
+ *
+ * @param uri the uri
+ * @throws IOException for an error accessing the uri
+ */
+ public void addURI(final URI uri) throws IOException
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("uri argument cannot be null");
+ }
+ if( uriList.add(uri) == true )
+ {
+ log.debug("Added URI: " + uri);
+ VirtualFile vf = getVFforURI(uri);
+ vdfList.add(vf);
+ }
+ }
+
+ /**
+ * Remove a uri
+ *
+ * @param uri the uri
+ * @throws IOException for an error accessing the uri
+ */
+ public void removeURI(final URI uri)
+ throws IOException
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("uri argument cannot be null");
+ }
+ VirtualFile vf = getVFforURI(uri);
+ vdfList.remove(vf);
+ boolean success = uriList.remove(uri);
+
+ if (success)
+ {
+ log.debug("Removed URI: " + uri);
+ }
+ }
+
+ /**
+ * Whether it has the uri
+ *
+ * @param uri the uri
+ * @return when the uri is configured
+ */
+ public boolean hasURI(final URI uri)
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("uri argument cannot be null");
+ }
+ return uriList.contains(uri);
+ }
+
+ /**
+ * Start the scan
+ *
+ * @throws Exception for any error
+ */
+ public void start() throws Exception
+ {
+ // synchronize uriList and vdfList because only at this point
+ // setVirtualFileFactory() injection has been performed
+ vdfList.clear();
+ for (Iterator<URI> i = uriList.iterator(); i.hasNext(); )
+ {
+ URI uri = i.next();
+ VirtualFile vf = this.getVFforURI(uri);
+ vdfList.add(vf);
+ }
+ if( profileKey == null )
+ {
+ profileKey = new ProfileKey("default");
+ }
+ scan();
+ }
+
+ /**
+ * Scan
+ *
+ * @throws Exception for any error
+ */
+ public synchronized void scan() throws Exception
+ {
+ if (vdfList == null)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+
+ boolean trace = log.isTraceEnabled();
+
+ // Scan for deployments
+ if (trace)
+ {
+ log.trace("Scanning for new deployments");
+ }
+
+ // VirtualFiles to deploy
+ List<VirtualFile> toDeployList = new LinkedList<VirtualFile>();
+ synchronized (vdfList)
+ {
+ for (Iterator i = vdfList.iterator(); i.hasNext();)
+ {
+ VirtualFile component = (VirtualFile)i.next();
+ if (component.isLeaf())
+ {
+ // treat this as a deployable unit
+ toDeployList.add(component);
+ }
+ else
+ {
+ // process (possibly recursively) the dir
+ addDeployments(toDeployList, component);
+ }
+ }
+ }
+
+ if (trace)
+ {
+ log.trace("toDeployList");
+ for (Iterator i = toDeployList.iterator(); i.hasNext();)
+ {
+ log.trace(i.next());
+ }
+ }
+ LinkedList<VirtualFile> toRemoveList = new LinkedList<VirtualFile>();
+
+ synchronized (deployedSet)
+ {
+ // remove previously deployed URLs no longer needed
+ for (VirtualFile deployedComponent : deployedSet.keySet())
+ {
+ if (toDeployList.contains(deployedComponent) == false)
+ {
+ toRemoveList.add(deployedComponent);
+ }
+ }
+ }
+
+ // ********
+ // Undeploy
+ // ********
+
+ for (Iterator i = toRemoveList.iterator(); i.hasNext();)
+ {
+ VirtualFile deployedComponent = (VirtualFile)i.next();
+ undeploy(deployedComponent);
+ }
+
+ // ******
+ // Deploy
+ // ******
+
+ for (Iterator i = toDeployList.iterator(); i.hasNext();)
+ {
+ VirtualFile component = (VirtualFile)i.next();
+
+ // if component is not deployed already, deploy it
+ if (!deployedSet.containsKey(component))
+ {
+ deploy(component);
+ }
+
+ // component must have been deployed by now, so remove it from list
+ i.remove();
+
+ }
+
+ }
+
+ /**
+ * Make a uri
+ *
+ * @param urispec the uri spec
+ * @return the uri
+ * @throws URISyntaxException for an error parsing he uri
+ */
+ private URI makeURI(String urispec) throws URISyntaxException
+ {
+ // First replace URI with appropriate properties
+ urispec = StringPropertyReplacer.replaceProperties(urispec);
+ return serverHomeURI.resolve(urispec);
+ }
+
+ /**
+ * A helper to find all deployments under a directory component
+ * and add them to the supplied list.
+ *
+ * We may recurse.
+ *
+ * @param list the list of virtual files
+ * @param root the root file
+ * @throws IOException for any error
+ */
+ private void addDeployments(List<VirtualFile> list, VirtualFile root)
+ throws IOException
+ {
+ List<VirtualFile> components = root.getChildren();
+
+ for (VirtualFile component : components)
+ {
+ // Filter the component regardless of its type
+ if( filter != null && filter.accepts(component) == false)
+ continue;
+ if (component.isLeaf())
+ {
+ list.add(component);
+ }
+ // TODO replace . in the name with isArchive() == false?
+ else if (component.getName().indexOf('.') == -1 && this.doRecursiveSearch)
+ {
+ // recurse if not '.' in name and recursive search is enabled
+ addDeployments(list, component);
+ }
+ else
+ {
+ list.add(component);
+ }
+ }
+ }
+
+ /**
+ * A helper to deploy the given component using the deployer.
+ *
+ * @param component the virtual file
+ */
+ private void deploy(final VirtualFile component)
+ {
+ // If the deployer is null simply ignore the request
+ if (profileService == null)
+ {
+ return;
+ }
+ if (log.isTraceEnabled())
+ {
+ log.trace("Deploying: " + component);
+ }
+
+ VFSDeployment deployment = null;
+ try
+ {
+ Profile profile = profileService.getProfile(profileKey);
+ deployment = add(profile, component);
+ }
+ catch (Exception e)
+ {
+ log.debug("Failed to deploy: " + component, e);
+ }
+
+ if (deployment != null && !deployedSet.containsKey(component))
+ {
+ deployedSet.put(component, deployment.getName());
+ }
+ }
+
+ /**
+ * A helper to undeploy the given component using the deployer.
+ *
+ * @param component the component
+ */
+ private void undeploy(final VirtualFile component)
+ {
+ try
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Undeploying: " + component);
+ }
+ String name = deployedSet.remove(component);
+ Profile profile = profileService.getProfile(profileKey);
+ remove(profile, name);
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to undeploy: " + component, e);
+ }
+ }
+
+ /**
+ * Remove the component
+ *
+ * @param profile the profile
+ * @param file the virtual file
+ * @return the deployment context or null if not added, e.g. it already exists
+ * @throws Exception for any error
+ */
+ protected abstract VFSDeployment add(Profile profile, VirtualFile file) throws Exception;
+
+ /**
+ * Remove the component
+ *
+ * @param profile the profile
+ * @param name the name
+ * @throws Exception for any error
+ */
+ protected abstract void remove(Profile profile, String name) throws Exception;
+
+ /**
+ * Create a deployment
+ *
+ * @param file the root file
+ * @return the deployment
+ */
+ protected VFSDeployment createDeployment(VirtualFile file)
+ {
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+ return deploymentFactory.createVFSDeployment(file);
+ }
+
+ /**
+ * Get virtual file for uri.
+ *
+ * @param uri the uri
+ * @return vritual file representing uri
+ * @throws IOException for any error
+ */
+ private VirtualFile getVFforURI(URI uri) throws IOException
+ {
+ return VFS.getCachedFile(uri);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,62 +1,62 @@
-/*
- * 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.server.profileservice.attachments;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class AttachmentMetaData
-{
-
- /** The attachment name */
- private String name;
-
- /** The attachment */
- private transient Object attachment;
-
- @XmlElement(name = "attachment-name")
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- @XmlTransient
- public Object getAttachment()
- {
- return attachment;
- }
-
- public void setAttachment(Object attachment)
- {
- this.attachment = attachment;
- }
-}
-
+/*
+ * 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.server.profileservice.attachments;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AttachmentMetaData
+{
+
+ /** The attachment name */
+ private String name;
+
+ /** The attachment */
+ private transient Object attachment;
+
+ @XmlElement(name = "attachment-name")
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlTransient
+ public Object getAttachment()
+ {
+ return attachment;
+ }
+
+ public void setAttachment(Object attachment)
+ {
+ this.attachment = attachment;
+ }
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,72 +1,72 @@
-/*
- * 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.server.profileservice.attachments;
-
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class DeploymentClassPathMetaData
-{
-
- /** The path */
- private String path;
-
- /** The suffixes */
- private String suffixes;
-
- public DeploymentClassPathMetaData()
- {
- //
- }
-
- public DeploymentClassPathMetaData(String path, String suffixes)
- {
- this.path = path;
- this.suffixes = suffixes;
- }
-
- @XmlElement(name = "path")
- public String getPath()
- {
- return path;
- }
-
- public void setPath(String path)
- {
- this.path = path;
- }
-
- @XmlElement(name = "suffixes")
- public String getSuffixes()
- {
- return suffixes;
- }
-
- public void setSuffixes(String suffixes)
- {
- this.suffixes = suffixes;
- }
-
-}
+/*
+ * 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.server.profileservice.attachments;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DeploymentClassPathMetaData
+{
+
+ /** The path */
+ private String path;
+
+ /** The suffixes */
+ private String suffixes;
+
+ public DeploymentClassPathMetaData()
+ {
+ //
+ }
+
+ public DeploymentClassPathMetaData(String path, String suffixes)
+ {
+ this.path = path;
+ this.suffixes = suffixes;
+ }
+
+ @XmlElement(name = "path")
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ @XmlElement(name = "suffixes")
+ public String getSuffixes()
+ {
+ return suffixes;
+ }
+
+ public void setSuffixes(String suffixes)
+ {
+ this.suffixes = suffixes;
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,108 +1,108 @@
-/*
- * 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.server.profileservice.attachments;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- * Basic xml representation helper class of the StructureMetaData.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class DeploymentStructureMetaData
-{
-
- /** The meta data path */
- private List<String> metaDataPaths;
-
- /** The class paths */
- private List<DeploymentClassPathMetaData> classPaths;
-
- /** The comparator class name */
- private String comparatorClass;
-
- /** The modifcation type */
- private String modificationType;
-
- /** The relative order */
- private int relatativeOrder;
-
-
- @XmlElement(name = "meta-data-path")
- public List<String> getMetaDataPaths()
- {
- return metaDataPaths;
- }
-
- public void setMetaDataPaths(List<String> metaDataPaths)
- {
- this.metaDataPaths = metaDataPaths;
- }
-
- @XmlElement(name = "class-path")
- public List<DeploymentClassPathMetaData> getClassPaths()
- {
- return classPaths;
- }
-
- public void setClassPaths(List<DeploymentClassPathMetaData> classPaths)
- {
- this.classPaths = classPaths;
- }
-
- @XmlElement(name = "comparator-class")
- public String getComparatorClass()
- {
- return comparatorClass;
- }
-
- public void setComparatorClass(String comparatorClass)
- {
- this.comparatorClass = comparatorClass;
- }
-
- @XmlElement(name = "relative-order")
- public int getRelatativeOrder()
- {
- return relatativeOrder;
- }
-
- public void setRelatativeOrder(int relatativeOrder)
- {
- this.relatativeOrder = relatativeOrder;
- }
-
- @XmlElement(name = "modifcation-type")
- public String getModificationType()
- {
- return modificationType;
- }
-
- public void setModificationType(String modificationType)
- {
- this.modificationType = modificationType;
- }
-
-}
+/*
+ * 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.server.profileservice.attachments;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Basic xml representation helper class of the StructureMetaData.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DeploymentStructureMetaData
+{
+
+ /** The meta data path */
+ private List<String> metaDataPaths;
+
+ /** The class paths */
+ private List<DeploymentClassPathMetaData> classPaths;
+
+ /** The comparator class name */
+ private String comparatorClass;
+
+ /** The modifcation type */
+ private String modificationType;
+
+ /** The relative order */
+ private int relatativeOrder;
+
+
+ @XmlElement(name = "meta-data-path")
+ public List<String> getMetaDataPaths()
+ {
+ return metaDataPaths;
+ }
+
+ public void setMetaDataPaths(List<String> metaDataPaths)
+ {
+ this.metaDataPaths = metaDataPaths;
+ }
+
+ @XmlElement(name = "class-path")
+ public List<DeploymentClassPathMetaData> getClassPaths()
+ {
+ return classPaths;
+ }
+
+ public void setClassPaths(List<DeploymentClassPathMetaData> classPaths)
+ {
+ this.classPaths = classPaths;
+ }
+
+ @XmlElement(name = "comparator-class")
+ public String getComparatorClass()
+ {
+ return comparatorClass;
+ }
+
+ public void setComparatorClass(String comparatorClass)
+ {
+ this.comparatorClass = comparatorClass;
+ }
+
+ @XmlElement(name = "relative-order")
+ public int getRelatativeOrder()
+ {
+ return relatativeOrder;
+ }
+
+ public void setRelatativeOrder(int relatativeOrder)
+ {
+ this.relatativeOrder = relatativeOrder;
+ }
+
+ @XmlElement(name = "modifcation-type")
+ public String getModificationType()
+ {
+ return modificationType;
+ }
+
+ public void setModificationType(String modificationType)
+ {
+ this.modificationType = modificationType;
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,212 +1,212 @@
-/*
- * 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.server.profileservice.attachments;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-
-import org.jboss.deployers.spi.attachments.AttachmentsFactory;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-
-/**
- * Basic wrapper for MutableAttachmets. This maintains a list of associated
- * metadata, which can be loaded lazily and delegates the attachments to AttachmentsImpl.
- *
- * TODO this should use a AttachmentSerializer which stores the meta data
- * as XML files.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class LazyPredeterminedManagedObjects implements MutableAttachments
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- /** The attachments */
- private final MutableAttachments delegate;
-
- /** The attachmentsSerializer */
- private final AttachmentsSerializer serializer;
-
- /** The relative path */
- private final String relativePath;
-
- /** The available attachments */
- private final Collection<String> attachments;
-
- public LazyPredeterminedManagedObjects(AttachmentsSerializer serializer, String relativePath, Collection<String> attachments)
- {
- if(serializer == null)
- throw new IllegalArgumentException("serializer may not be null;");
- if(relativePath == null)
- throw new IllegalArgumentException("relativePath may not be null;");
- if(attachments == null)
- throw new IllegalArgumentException("serializer may not be null;");
-
- // Create a mutable attachment
- this.delegate = AttachmentsFactory.createMutableAttachments();
- // The serializer
- this.serializer = serializer;
- // Fix the path, if needed
- this.relativePath = relativePath.endsWith(File.separator) ? relativePath : relativePath + File.separator;
- // The attachments, which can be loaded
- this.attachments = attachments;
-
- }
-
- public Object addAttachment(String name, Object attachment)
- {
- return delegate.addAttachment(name, attachment);
- }
-
- public <T> T addAttachment(Class<T> type, T attachment)
- {
- return delegate.addAttachment(type, attachment);
- }
-
- public <T> T addAttachment(String name, T attachment, Class<T> expectedType)
- {
- return delegate.addAttachment(name, attachment, expectedType);
- }
-
- public void clear()
- {
- delegate.clear();
- }
-
- public void clearChangeCount()
- {
- delegate.clearChangeCount();
- }
-
- public int getChangeCount()
- {
- return delegate.getChangeCount();
- }
-
- public Object removeAttachment(String name)
- {
- return delegate.removeAttachment(name);
- }
-
- public <T> T removeAttachment(Class<T> type)
- {
- return delegate.removeAttachment(type);
- }
-
- public <T> T removeAttachment(String name, Class<T> expectedType)
- {
- return delegate.removeAttachment(name, expectedType);
- }
-
- public void setAttachments(Map<String, Object> map)
- {
- delegate.setAttachments(map);
- }
-
- public Object getAttachment(String name)
- {
- Object o = delegate.getAttachment(name);
- if(o == null) o = loadAttachment(name);
- return o;
- }
-
- public <T> T getAttachment(Class<T> type)
- {
- T o = delegate.getAttachment(type);
- if(o == null) o = (T) loadAttachment(type.getName());
- return o;
- }
-
- public <T> T getAttachment(String name, Class<T> expectedType)
- {
- T o = delegate.getAttachment(name, expectedType);
- if(o == null) o = (T) loadAttachment(name);
- return o;
- }
-
- public Map<String, Object> getAttachments()
- {
- // TODO - load all attachments ?
- return delegate.getAttachments();
- }
-
- public boolean hasAttachments()
- {
- if(! this.attachments.isEmpty()) return true;
- return delegate.hasAttachments();
- }
-
- public boolean isAttachmentPresent(String name)
- {
- if(ishandleAttachment(name)) return true;
- return delegate.isAttachmentPresent(name);
- }
-
- public boolean isAttachmentPresent(Class<?> type)
- {
- if(ishandleAttachment(type.getName())) return true;
- return delegate.isAttachmentPresent(type);
- }
-
- public boolean isAttachmentPresent(String name, Class<?> expectedType)
- {
- if(ishandleAttachment(name)) return true;
- return delegate.isAttachmentPresent(name, expectedType);
- }
-
- private boolean ishandleAttachment(String name)
- {
- return attachments.contains(name);
- }
-
- private Object loadAttachment(String name)
- {
- if(! attachments.contains(name))
- return null;
-
- try
- {
- // deploy/deployment/child/attachmentName
- String attachmentName = relativePath + name;
- // use the con
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- // Load class
- Class<?> expected = cl.loadClass(name);
- // Load attachment
- Object o = serializer.loadAttachment(attachmentName, expected);
- // Add attachment
- if(o != null)
- this.delegate.addAttachment(name, o);
- // Return attachment
- return o;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- }
+/*
+ * 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.server.profileservice.attachments;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Map;
+
+import org.jboss.deployers.spi.attachments.AttachmentsFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.profileservice.spi.AttachmentsSerializer;
+
+/**
+ * Basic wrapper for MutableAttachmets. This maintains a list of associated
+ * metadata, which can be loaded lazily and delegates the attachments to AttachmentsImpl.
+ *
+ * TODO this should use a AttachmentSerializer which stores the meta data
+ * as XML files.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LazyPredeterminedManagedObjects implements MutableAttachments
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ /** The attachments */
+ private final MutableAttachments delegate;
+
+ /** The attachmentsSerializer */
+ private final AttachmentsSerializer serializer;
+
+ /** The relative path */
+ private final String relativePath;
+
+ /** The available attachments */
+ private final Collection<String> attachments;
+
+ public LazyPredeterminedManagedObjects(AttachmentsSerializer serializer, String relativePath, Collection<String> attachments)
+ {
+ if(serializer == null)
+ throw new IllegalArgumentException("serializer may not be null;");
+ if(relativePath == null)
+ throw new IllegalArgumentException("relativePath may not be null;");
+ if(attachments == null)
+ throw new IllegalArgumentException("serializer may not be null;");
+
+ // Create a mutable attachment
+ this.delegate = AttachmentsFactory.createMutableAttachments();
+ // The serializer
+ this.serializer = serializer;
+ // Fix the path, if needed
+ this.relativePath = relativePath.endsWith(File.separator) ? relativePath : relativePath + File.separator;
+ // The attachments, which can be loaded
+ this.attachments = attachments;
+
+ }
+
+ public Object addAttachment(String name, Object attachment)
+ {
+ return delegate.addAttachment(name, attachment);
+ }
+
+ public <T> T addAttachment(Class<T> type, T attachment)
+ {
+ return delegate.addAttachment(type, attachment);
+ }
+
+ public <T> T addAttachment(String name, T attachment, Class<T> expectedType)
+ {
+ return delegate.addAttachment(name, attachment, expectedType);
+ }
+
+ public void clear()
+ {
+ delegate.clear();
+ }
+
+ public void clearChangeCount()
+ {
+ delegate.clearChangeCount();
+ }
+
+ public int getChangeCount()
+ {
+ return delegate.getChangeCount();
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return delegate.removeAttachment(name);
+ }
+
+ public <T> T removeAttachment(Class<T> type)
+ {
+ return delegate.removeAttachment(type);
+ }
+
+ public <T> T removeAttachment(String name, Class<T> expectedType)
+ {
+ return delegate.removeAttachment(name, expectedType);
+ }
+
+ public void setAttachments(Map<String, Object> map)
+ {
+ delegate.setAttachments(map);
+ }
+
+ public Object getAttachment(String name)
+ {
+ Object o = delegate.getAttachment(name);
+ if(o == null) o = loadAttachment(name);
+ return o;
+ }
+
+ public <T> T getAttachment(Class<T> type)
+ {
+ T o = delegate.getAttachment(type);
+ if(o == null) o = (T) loadAttachment(type.getName());
+ return o;
+ }
+
+ public <T> T getAttachment(String name, Class<T> expectedType)
+ {
+ T o = delegate.getAttachment(name, expectedType);
+ if(o == null) o = (T) loadAttachment(name);
+ return o;
+ }
+
+ public Map<String, Object> getAttachments()
+ {
+ // TODO - load all attachments ?
+ return delegate.getAttachments();
+ }
+
+ public boolean hasAttachments()
+ {
+ if(! this.attachments.isEmpty()) return true;
+ return delegate.hasAttachments();
+ }
+
+ public boolean isAttachmentPresent(String name)
+ {
+ if(ishandleAttachment(name)) return true;
+ return delegate.isAttachmentPresent(name);
+ }
+
+ public boolean isAttachmentPresent(Class<?> type)
+ {
+ if(ishandleAttachment(type.getName())) return true;
+ return delegate.isAttachmentPresent(type);
+ }
+
+ public boolean isAttachmentPresent(String name, Class<?> expectedType)
+ {
+ if(ishandleAttachment(name)) return true;
+ return delegate.isAttachmentPresent(name, expectedType);
+ }
+
+ private boolean ishandleAttachment(String name)
+ {
+ return attachments.contains(name);
+ }
+
+ private Object loadAttachment(String name)
+ {
+ if(! attachments.contains(name))
+ return null;
+
+ try
+ {
+ // deploy/deployment/child/attachmentName
+ String attachmentName = relativePath + name;
+ // use the con
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ // Load class
+ Class<?> expected = cl.loadClass(name);
+ // Load attachment
+ Object o = serializer.loadAttachment(attachmentName, expected);
+ // Add attachment
+ if(o != null)
+ this.delegate.addAttachment(name, o);
+ // Return attachment
+ return o;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,110 +1,110 @@
-/*
- * 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.server.profileservice.attachments;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Metadata describing the persisted deployment attachments.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at XmlRootElement(name = "attachments-metadata")
-public class RepositoryAttachmentMetaData
-{
-
- /** The deployment */
- private String deploymentName;
-
- /** The last update timestamp */
- private long lastModified;
-
- /** The children */
- private List<RepositoryAttachmentMetaData> children;
-
- /** The attachments */
- private List<AttachmentMetaData> attachments;
-
- /** The deployment structure */
- private DeploymentStructureMetaData deploymentStructure;
-
- @XmlElement(name = "deployment-name")
- public String getDeploymentName()
- {
- return deploymentName;
- }
-
- public void setDeploymentName(String deploymentName)
- {
- this.deploymentName = deploymentName;
- }
-
- @XmlElement(name = "last-modified")
- public long getLastModified()
- {
- return lastModified;
- }
-
- public void setLastModified(long lastModified)
- {
- this.lastModified = lastModified;
- }
-
- @XmlElement(name = "deployment-structure")
- public DeploymentStructureMetaData getDeploymentStructure()
- {
- return deploymentStructure;
- }
-
- public void setDeploymentStructure(DeploymentStructureMetaData deploymentStructure)
- {
- this.deploymentStructure = deploymentStructure;
- }
-
- @XmlElement(name = "child")
- public List<RepositoryAttachmentMetaData> getChildren()
- {
- return children;
- }
-
- public void setChildren(List<RepositoryAttachmentMetaData> children)
- {
- this.children = children;
- }
-
- @XmlElement(name = "attachment")
- public List<AttachmentMetaData> getAttachments()
- {
- return attachments;
- }
-
- public void setAttachments(List<AttachmentMetaData> attachments)
- {
- this.attachments = attachments;
- }
-
-}
-
+/*
+ * 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.server.profileservice.attachments;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Metadata describing the persisted deployment attachments.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlRootElement(name = "attachments-metadata")
+public class RepositoryAttachmentMetaData
+{
+
+ /** The deployment */
+ private String deploymentName;
+
+ /** The last update timestamp */
+ private long lastModified;
+
+ /** The children */
+ private List<RepositoryAttachmentMetaData> children;
+
+ /** The attachments */
+ private List<AttachmentMetaData> attachments;
+
+ /** The deployment structure */
+ private DeploymentStructureMetaData deploymentStructure;
+
+ @XmlElement(name = "deployment-name")
+ public String getDeploymentName()
+ {
+ return deploymentName;
+ }
+
+ public void setDeploymentName(String deploymentName)
+ {
+ this.deploymentName = deploymentName;
+ }
+
+ @XmlElement(name = "last-modified")
+ public long getLastModified()
+ {
+ return lastModified;
+ }
+
+ public void setLastModified(long lastModified)
+ {
+ this.lastModified = lastModified;
+ }
+
+ @XmlElement(name = "deployment-structure")
+ public DeploymentStructureMetaData getDeploymentStructure()
+ {
+ return deploymentStructure;
+ }
+
+ public void setDeploymentStructure(DeploymentStructureMetaData deploymentStructure)
+ {
+ this.deploymentStructure = deploymentStructure;
+ }
+
+ @XmlElement(name = "child")
+ public List<RepositoryAttachmentMetaData> getChildren()
+ {
+ return children;
+ }
+
+ public void setChildren(List<RepositoryAttachmentMetaData> children)
+ {
+ this.children = children;
+ }
+
+ @XmlElement(name = "attachment")
+ public List<AttachmentMetaData> getAttachments()
+ {
+ return attachments;
+ }
+
+ public void setAttachments(List<AttachmentMetaData> attachments)
+ {
+ this.attachments = attachments;
+ }
+
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,123 +1,123 @@
-/*
- * 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.server.profileservice.attachments;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.deployers.spi.structure.ClassPathEntry;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.managed.api.ManagedDeployment;
-
-/**
- * Common RepositoryAttachmentMetaData operations.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class RepositoryAttachmentMetaDataFactory
-{
-
- public static RepositoryAttachmentMetaData createInstance()
- {
- return new RepositoryAttachmentMetaData();
- }
-
- public static RepositoryAttachmentMetaData createInstance(ManagedDeployment md)
- {
- if(md == null)
- throw new IllegalArgumentException("managed deployment may not be null.");
-
- RepositoryAttachmentMetaData metaData = createInstance();
- metaData.setDeploymentName(md.getSimpleName());
- return metaData;
- }
-
- public static RepositoryAttachmentMetaData createNewParent(ManagedDeployment md, RepositoryAttachmentMetaData child)
- {
- if(md == null)
- throw new IllegalArgumentException("managed deployment may not be null.");
-
- RepositoryAttachmentMetaData metaData = createInstance(md);
- addChild(metaData, child);
- return metaData;
- }
-
- public static void addChild(RepositoryAttachmentMetaData parent, RepositoryAttachmentMetaData child)
- {
- if(parent == null)
- throw new IllegalArgumentException("parent may not be null.");
-
- if(parent.getChildren() == null)
- parent.setChildren(new ArrayList<RepositoryAttachmentMetaData>());
-
- parent.getChildren().add(child);
- }
-
- public static void addAttachment(RepositoryAttachmentMetaData metaData, AttachmentMetaData attachment)
- {
- if(metaData == null)
- throw new IllegalArgumentException("meta data may not be null.");
-
- if(metaData.getAttachments() == null)
- metaData.setAttachments(new ArrayList<AttachmentMetaData>());
-
- metaData.getAttachments().add(attachment);
- }
-
- public static void applyStructureContext(RepositoryAttachmentMetaData metaData, ContextInfo info)
- {
- if(metaData == null)
- throw new IllegalArgumentException("meta data may not be null.");
- if(info == null)
- throw new IllegalArgumentException("context info may not be null.");
-
- DeploymentStructureMetaData structure = new DeploymentStructureMetaData();
-
- // meta data paths
- structure.setMetaDataPaths(info.getMetaDataPath());
- // classpath
- structure.setClassPaths(getDeploymentClassPathMetaData(info));
- // comparator
- structure.setComparatorClass(info.getComparatorClassName());
- // relativeOrder
- structure.setRelatativeOrder(info.getRelativeOrder());
-
- metaData.setDeploymentStructure(structure);
- }
-
- protected static List<DeploymentClassPathMetaData> getDeploymentClassPathMetaData(ContextInfo info)
- {
- if(info == null)
- throw new IllegalArgumentException("context info may not be null.");
-
- if(info.getClassPath() == null || info.getClassPath().isEmpty())
- return null;
-
- List<DeploymentClassPathMetaData> classPath = new ArrayList<DeploymentClassPathMetaData>();
- for(ClassPathEntry entry : info.getClassPath())
- classPath.add(new DeploymentClassPathMetaData(entry.getPath(), entry.getSuffixes()));
-
- return classPath;
- }
-}
-
+/*
+ * 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.server.profileservice.attachments;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.managed.api.ManagedDeployment;
+
+/**
+ * Common RepositoryAttachmentMetaData operations.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class RepositoryAttachmentMetaDataFactory
+{
+
+ public static RepositoryAttachmentMetaData createInstance()
+ {
+ return new RepositoryAttachmentMetaData();
+ }
+
+ public static RepositoryAttachmentMetaData createInstance(ManagedDeployment md)
+ {
+ if(md == null)
+ throw new IllegalArgumentException("managed deployment may not be null.");
+
+ RepositoryAttachmentMetaData metaData = createInstance();
+ metaData.setDeploymentName(md.getSimpleName());
+ return metaData;
+ }
+
+ public static RepositoryAttachmentMetaData createNewParent(ManagedDeployment md, RepositoryAttachmentMetaData child)
+ {
+ if(md == null)
+ throw new IllegalArgumentException("managed deployment may not be null.");
+
+ RepositoryAttachmentMetaData metaData = createInstance(md);
+ addChild(metaData, child);
+ return metaData;
+ }
+
+ public static void addChild(RepositoryAttachmentMetaData parent, RepositoryAttachmentMetaData child)
+ {
+ if(parent == null)
+ throw new IllegalArgumentException("parent may not be null.");
+
+ if(parent.getChildren() == null)
+ parent.setChildren(new ArrayList<RepositoryAttachmentMetaData>());
+
+ parent.getChildren().add(child);
+ }
+
+ public static void addAttachment(RepositoryAttachmentMetaData metaData, AttachmentMetaData attachment)
+ {
+ if(metaData == null)
+ throw new IllegalArgumentException("meta data may not be null.");
+
+ if(metaData.getAttachments() == null)
+ metaData.setAttachments(new ArrayList<AttachmentMetaData>());
+
+ metaData.getAttachments().add(attachment);
+ }
+
+ public static void applyStructureContext(RepositoryAttachmentMetaData metaData, ContextInfo info)
+ {
+ if(metaData == null)
+ throw new IllegalArgumentException("meta data may not be null.");
+ if(info == null)
+ throw new IllegalArgumentException("context info may not be null.");
+
+ DeploymentStructureMetaData structure = new DeploymentStructureMetaData();
+
+ // meta data paths
+ structure.setMetaDataPaths(info.getMetaDataPath());
+ // classpath
+ structure.setClassPaths(getDeploymentClassPathMetaData(info));
+ // comparator
+ structure.setComparatorClass(info.getComparatorClassName());
+ // relativeOrder
+ structure.setRelatativeOrder(info.getRelativeOrder());
+
+ metaData.setDeploymentStructure(structure);
+ }
+
+ protected static List<DeploymentClassPathMetaData> getDeploymentClassPathMetaData(ContextInfo info)
+ {
+ if(info == null)
+ throw new IllegalArgumentException("context info may not be null.");
+
+ if(info.getClassPath() == null || info.getClassPath().isEmpty())
+ return null;
+
+ List<DeploymentClassPathMetaData> classPath = new ArrayList<DeploymentClassPathMetaData>();
+ for(ClassPathEntry entry : info.getClassPath())
+ classPath.add(new DeploymentClassPathMetaData(entry.getPath(), entry.getSuffixes()));
+
+ return classPath;
+ }
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,79 +1,79 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.basic;
-
-import java.io.IOException;
-
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.system.server.profile.basic.MetaDataAwareProfile;
-import org.jboss.virtual.VirtualFileFilter;
-
-
-/**
- * Profile service creating profiles that
- * monitor metadata changes.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class MetaDataAwareProfileService extends ProfileServiceImpl
-{
- private MainDeployerStructure mainDeployer;
- private VirtualFileFilter filter;
-
- public MetaDataAwareProfileService(String name) throws IOException
- {
- super(name);
- }
-
- protected Profile createProfile(ProfileKey key)
- {
- if (mainDeployer == null)
- throw new IllegalArgumentException("Null main deployer");
-
- MetaDataAwareProfile profile = new MetaDataAwareProfile(getProfileRoot(), key);
- profile.setMainDeployer(mainDeployer);
- profile.setFilter(filter);
- return profile;
- }
-
- /**
- * Set main deployer structure.
- *
- * @param mainDeployer the main deployer structure
- */
- public void setMainDeployer(MainDeployerStructure mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Set the metadata resources filter.
- *
- * @param filter the metadata resources filter
- */
- public void setFilter(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.basic;
+
+import java.io.IOException;
+
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.system.server.profile.basic.MetaDataAwareProfile;
+import org.jboss.virtual.VirtualFileFilter;
+
+
+/**
+ * Profile service creating profiles that
+ * monitor metadata changes.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MetaDataAwareProfileService extends ProfileServiceImpl
+{
+ private MainDeployerStructure mainDeployer;
+ private VirtualFileFilter filter;
+
+ public MetaDataAwareProfileService(String name) throws IOException
+ {
+ super(name);
+ }
+
+ protected Profile createProfile(ProfileKey key)
+ {
+ if (mainDeployer == null)
+ throw new IllegalArgumentException("Null main deployer");
+
+ MetaDataAwareProfile profile = new MetaDataAwareProfile(getProfileRoot(), key);
+ profile.setMainDeployer(mainDeployer);
+ profile.setFilter(filter);
+ return profile;
+ }
+
+ /**
+ * Set main deployer structure.
+ *
+ * @param mainDeployer the main deployer structure
+ */
+ public void setMainDeployer(MainDeployerStructure mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Set the metadata resources filter.
+ *
+ * @param filter the metadata resources filter
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
}
\ No newline at end of file
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,155 +1,155 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.basic;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profile.basic.ProfileImpl;
-
-
-/**
- * An basic ProfileService impl for loading server deployments
- * that uses the basic ProfileImpl.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ProfileServiceImpl
- implements ProfileService
-{
- private String name;
- private String profileRoot;
- private Profile defaultImpl;
- private ManagementView mgtView;
- private DeploymentManager deployMgr;
-
- public ProfileServiceImpl(String name) throws IOException
- {
- this.name = name;
- }
- // Properties ------------------------
-
- public String getName()
- {
- return this.name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
- public String getProfileRoot()
- {
- return this.profileRoot;
- }
- public void setProfileRoot(String profileRoot)
- {
- this.profileRoot = profileRoot;
- }
-
- public void start()
- {
- ProfileKey key = new ProfileKey(name);
- defaultImpl = createProfile(key);
- }
-
- /**
- * Create default profile.
- *
- * @param key the profile key
- * @return new profile instance
- */
- protected Profile createProfile(ProfileKey key)
- {
- return new ProfileImpl(profileRoot, key);
- }
-
- // ProfileService implementation --------------------
- public String[] getDomains()
- {
- return new String[]{ProfileKey.DEFAULT};
- }
-
- public Collection<ProfileKey> getProfileKeys()
- {
- Collection<ProfileKey> keys = new HashSet<ProfileKey>();
- keys.add(new ProfileKey(null));
- return keys;
- }
-
- /**
- * Always returns the default profile.
- */
- public Profile getProfile(ProfileKey key)
- throws NoSuchProfileException
- {
- return defaultImpl;
- }
- public Profile getActiveProfile()
- throws NoSuchProfileException
- {
- return defaultImpl;
- }
-
- public String[] getProfileDeploymentNames(ProfileKey key)
- throws NoSuchProfileException
- {
- return new String[]{"default"};
- }
-
- public ManagementView getViewManager()
- {
- return mgtView;
- }
- public void setViewManager(ManagementView mgtView)
- {
- this.mgtView = mgtView;
- }
-
- public DeploymentManager getDeploymentManager()
- {
- return deployMgr;
- }
- public void setDeploymentManager(DeploymentManager deployMgr)
- {
- this.deployMgr = deployMgr;
- }
-
- // Admin of profiles @todo could be an option plugin
- public Profile newProfile(ProfileKey key)
- {
- return new ProfileImpl(profileRoot, key);
- }
-
- public void removeProfile(ProfileKey key)
- throws NoSuchProfileException
- {
- }
-}
-
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.basic;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profile.basic.ProfileImpl;
+
+
+/**
+ * An basic ProfileService impl for loading server deployments
+ * that uses the basic ProfileImpl.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ProfileServiceImpl
+ implements ProfileService
+{
+ private String name;
+ private String profileRoot;
+ private Profile defaultImpl;
+ private ManagementView mgtView;
+ private DeploymentManager deployMgr;
+
+ public ProfileServiceImpl(String name) throws IOException
+ {
+ this.name = name;
+ }
+ // Properties ------------------------
+
+ public String getName()
+ {
+ return this.name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+ public String getProfileRoot()
+ {
+ return this.profileRoot;
+ }
+ public void setProfileRoot(String profileRoot)
+ {
+ this.profileRoot = profileRoot;
+ }
+
+ public void start()
+ {
+ ProfileKey key = new ProfileKey(name);
+ defaultImpl = createProfile(key);
+ }
+
+ /**
+ * Create default profile.
+ *
+ * @param key the profile key
+ * @return new profile instance
+ */
+ protected Profile createProfile(ProfileKey key)
+ {
+ return new ProfileImpl(profileRoot, key);
+ }
+
+ // ProfileService implementation --------------------
+ public String[] getDomains()
+ {
+ return new String[]{ProfileKey.DEFAULT};
+ }
+
+ public Collection<ProfileKey> getProfileKeys()
+ {
+ Collection<ProfileKey> keys = new HashSet<ProfileKey>();
+ keys.add(new ProfileKey(null));
+ return keys;
+ }
+
+ /**
+ * Always returns the default profile.
+ */
+ public Profile getProfile(ProfileKey key)
+ throws NoSuchProfileException
+ {
+ return defaultImpl;
+ }
+ public Profile getActiveProfile()
+ throws NoSuchProfileException
+ {
+ return defaultImpl;
+ }
+
+ public String[] getProfileDeploymentNames(ProfileKey key)
+ throws NoSuchProfileException
+ {
+ return new String[]{"default"};
+ }
+
+ public ManagementView getViewManager()
+ {
+ return mgtView;
+ }
+ public void setViewManager(ManagementView mgtView)
+ {
+ this.mgtView = mgtView;
+ }
+
+ public DeploymentManager getDeploymentManager()
+ {
+ return deployMgr;
+ }
+ public void setDeploymentManager(DeploymentManager deployMgr)
+ {
+ this.deployMgr = deployMgr;
+ }
+
+ // Admin of profiles @todo could be an option plugin
+ public Profile newProfile(ProfileKey key)
+ {
+ return new ProfileImpl(profileRoot, key);
+ }
+
+ public void removeProfile(ProfileKey key)
+ throws NoSuchProfileException
+ {
+ }
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,34 +1,34 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
-
-import java.io.Serializable;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class DeploymentRecord implements Serializable
-{
- private static final long serialVersionUID = 1;
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
+
+import java.io.Serializable;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DeploymentRecord implements Serializable
+{
+ private static final long serialVersionUID = 1;
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,146 +1,146 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileRepository;
-
-/**
- * An implementation of ProfileRepository that uses the following
- * file system structure for storing deployments and admin
- * edits.
- *
- * root-file
- * + server/{name}/bootstrap - bootstrap beans/services
- * + server/{name}/deployers - profile deployers
- * + server/{name}/deploy - installed deployments
- * + server/{name}/apps - post install deployments
- * + server/{name}/admin - admin edits to deployments
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class FileProfileRepository
- implements ProfileRepository
-{
- private File root;
- DeploymentRepositoryFactory repositoryFactory;
- private MainDeployer mainDeployer;
-
- public FileProfileRepository()
- {
- this(null);
- }
- public FileProfileRepository(File root)
- {
- this.root = root;
- }
-
- public DeploymentRepositoryFactory getRepositoryFactory()
- {
- return repositoryFactory;
- }
- public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
- {
- this.repositoryFactory = repositoryFactory;
- }
- public MainDeployer getMainDeployer()
- {
- return mainDeployer;
- }
- public void setMainDeployer(MainDeployer mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Get the server profile store root directory.
- * @return the server profile root directory containing the
- * available profiles.
- */
- public File getStoreRoot()
- {
- return root;
- }
- /**
- * Set the profiles store root.
- * @param root - the server profile root directory containing the
- * available profiles.
- */
- public void setStoreRoot(File root)
- {
- this.root = root;
- }
-
- /**
- * Get the keys for all known profiles. This lists the root store to
- * obtain the server profiles.
- * @return keys for all known profiles
- */
- public Collection<ProfileKey> getProfileKeys()
- {
- Collection<ProfileKey> keys = new HashSet<ProfileKey>();
- for(File profile : root.listFiles())
- {
- keys.add(new ProfileKey(profile.getName()));
- }
- return keys;
- }
-
- /**
- *
- */
- public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
- throws Exception
- {
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- repository.create();
- return repository;
- }
-
- /**
- * Load an existing profile deployment repository.
- */
- public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
- throws Exception, NoSuchProfileException
- {
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- repository.load();
- return repository;
- }
-
- public void removeProfileDeploymentRepository(ProfileKey key)
- throws Exception, NoSuchProfileException
- {
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- repository.remove();
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileRepository;
+
+/**
+ * An implementation of ProfileRepository that uses the following
+ * file system structure for storing deployments and admin
+ * edits.
+ *
+ * root-file
+ * + server/{name}/bootstrap - bootstrap beans/services
+ * + server/{name}/deployers - profile deployers
+ * + server/{name}/deploy - installed deployments
+ * + server/{name}/apps - post install deployments
+ * + server/{name}/admin - admin edits to deployments
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class FileProfileRepository
+ implements ProfileRepository
+{
+ private File root;
+ DeploymentRepositoryFactory repositoryFactory;
+ private MainDeployer mainDeployer;
+
+ public FileProfileRepository()
+ {
+ this(null);
+ }
+ public FileProfileRepository(File root)
+ {
+ this.root = root;
+ }
+
+ public DeploymentRepositoryFactory getRepositoryFactory()
+ {
+ return repositoryFactory;
+ }
+ public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
+ {
+ this.repositoryFactory = repositoryFactory;
+ }
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Get the server profile store root directory.
+ * @return the server profile root directory containing the
+ * available profiles.
+ */
+ public File getStoreRoot()
+ {
+ return root;
+ }
+ /**
+ * Set the profiles store root.
+ * @param root - the server profile root directory containing the
+ * available profiles.
+ */
+ public void setStoreRoot(File root)
+ {
+ this.root = root;
+ }
+
+ /**
+ * Get the keys for all known profiles. This lists the root store to
+ * obtain the server profiles.
+ * @return keys for all known profiles
+ */
+ public Collection<ProfileKey> getProfileKeys()
+ {
+ Collection<ProfileKey> keys = new HashSet<ProfileKey>();
+ for(File profile : root.listFiles())
+ {
+ keys.add(new ProfileKey(profile.getName()));
+ }
+ return keys;
+ }
+
+ /**
+ *
+ */
+ public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
+ throws Exception
+ {
+ DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+ repository.create();
+ return repository;
+ }
+
+ /**
+ * Load an existing profile deployment repository.
+ */
+ public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
+ throws Exception, NoSuchProfileException
+ {
+ DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+ repository.load();
+ return repository;
+ }
+
+ public void removeProfileDeploymentRepository(ProfileKey key)
+ throws Exception, NoSuchProfileException
+ {
+ DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+ repository.remove();
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,61 +1,61 @@
-/*
- * 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.server.profileservice.repository;
-
-import java.io.File;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.jboss.logging.Logger;
-
-/**
- * A basic JAXB attachment serializer.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class JAXBAttachmentSerializer extends AbstractFileAttachmentsSerializer
-{
-
- /** The logger */
- private static final Logger log = Logger.getLogger(JAXBAttachmentSerializer.class);
-
- @SuppressWarnings("unchecked")
- protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
- {
- JAXBContext ctx = JAXBContext.newInstance(expected);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- return (T) unmarshaller.unmarshal(attachmentsStore);
- }
-
- protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
- {
- log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
- JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
- Marshaller marshaller = ctx.createMarshaller();
- marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
- marshaller.marshal(attachment, attachmentsStore);
- }
-}
-
+/*
+ * 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.server.profileservice.repository;
+
+import java.io.File;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A basic JAXB attachment serializer.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class JAXBAttachmentSerializer extends AbstractFileAttachmentsSerializer
+{
+
+ /** The logger */
+ private static final Logger log = Logger.getLogger(JAXBAttachmentSerializer.class);
+
+ @SuppressWarnings("unchecked")
+ protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
+ {
+ JAXBContext ctx = JAXBContext.newInstance(expected);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ return (T) unmarshaller.unmarshal(attachmentsStore);
+ }
+
+ protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
+ {
+ log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
+ JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
+ Marshaller marshaller = ctx.createMarshaller();
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.marshal(attachment, attachmentsStore);
+ }
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,102 +1,102 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
-
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import org.jboss.logging.Logger;
-
-/**
- * An AttachmentsSerializer that uses the java bean long term xml serialization
- * format.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class JavaBeanXmlAttachmentsSerializer extends AbstractFileAttachmentsSerializer
-{
- private static final Logger log = Logger.getLogger(JavaBeanXmlAttachmentsSerializer.class);
-
- @Override
- @SuppressWarnings("unchecked")
- protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
- {
- T object = null;
- FileInputStream fis = new FileInputStream(attachmentsStore);
- XMLDecoder ois = new XMLDecoder(fis);
- try
- {
- object = (T) ois.readObject();
- }
- finally
- {
- try
- {
- ois.close();
- }
- catch(Exception igore)
- {
- }
- try
- {
- fis.close();
- }
- catch(Exception igore)
- {
- }
- }
- return object;
- }
-
- @Override
- protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
- {
- log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
- FileOutputStream fos = new FileOutputStream(attachmentsStore);
- XMLEncoder oos = new XMLEncoder(fos);
- try
- {
- oos.writeObject(attachment);
- }
- finally
- {
- try
- {
- oos.close();
- }
- catch(Exception igore)
- {
- }
- try
- {
- fos.close();
- }
- catch(Exception igore)
- {
- }
- }
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
+
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import org.jboss.logging.Logger;
+
+/**
+ * An AttachmentsSerializer that uses the java bean long term xml serialization
+ * format.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class JavaBeanXmlAttachmentsSerializer extends AbstractFileAttachmentsSerializer
+{
+ private static final Logger log = Logger.getLogger(JavaBeanXmlAttachmentsSerializer.class);
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
+ {
+ T object = null;
+ FileInputStream fis = new FileInputStream(attachmentsStore);
+ XMLDecoder ois = new XMLDecoder(fis);
+ try
+ {
+ object = (T) ois.readObject();
+ }
+ finally
+ {
+ try
+ {
+ ois.close();
+ }
+ catch(Exception igore)
+ {
+ }
+ try
+ {
+ fis.close();
+ }
+ catch(Exception igore)
+ {
+ }
+ }
+ return object;
+ }
+
+ @Override
+ protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
+ {
+ log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
+ FileOutputStream fos = new FileOutputStream(attachmentsStore);
+ XMLEncoder oos = new XMLEncoder(fos);
+ try
+ {
+ oos.writeObject(attachment);
+ }
+ finally
+ {
+ try
+ {
+ oos.close();
+ }
+ catch(Exception igore)
+ {
+ }
+ try
+ {
+ fos.close();
+ }
+ catch(Exception igore)
+ {
+ }
+ }
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,216 +1,216 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileRepository;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profile.repository.ProfileImpl;
-
-
-/**
- * A ProfileService impl that uses a ProfileRepository/DeploymentRepository
- * based Profile implementation.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ProfileServiceImpl
- implements ProfileService
-{
- private static final Logger log = Logger.getLogger(ProfileServiceImpl.class);
- /** The name of the profile to use */
- private String name;
- /** The profile repository plugin */
- private ProfileRepository profileRepository;
- /** The deployment repository plugin for the current profile */
- private DeploymentRepository deploymentRepository;
- /** The active profile */
- private Profile profile;
- /** The management view for the active profile */
- private ManagementView mgtView;
- /** The profiles DeploymentManager */
- private DeploymentManager deployMgr;
- /** The version of the profile to use */
- private String version;
-
- public ProfileServiceImpl(String name) throws IOException
- {
- this.name = name;
- }
- // Properties ------------------------
-
- public String getName()
- {
- return this.name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- public ProfileRepository getProfileRepository()
- {
- return profileRepository;
- }
-
- public void setProfileRepository(ProfileRepository profileRepository)
- {
- this.profileRepository = profileRepository;
- }
-
- public DeploymentRepository getDeploymentRepository()
- {
- return deploymentRepository;
- }
-
- public void setDeploymentRepository(DeploymentRepository repository)
- {
- this.deploymentRepository = repository;
- }
-
- public void start()
- throws Exception
- {
- if( profileRepository == null )
- throw new IllegalStateException("No profileRepository specified");
- // Obtain the deployment repository for the profile
- ProfileKey key = new ProfileKey(name);
- Profile profile = this.getProfile(key);
- log.info("Loaded profile: "+profile);
- }
-
- // ProfileService implementation --------------------
- /**
- * There is only the default domain (ProfileKey.DEFAULT)
- */
- public String[] getDomains()
- {
- String[] domains = {ProfileKey.DEFAULT};
- return domains;
- }
-
- /**
- * Get the keys for all known profiles
- * @return keys for all known profiles
- */
- public Collection<ProfileKey> getProfileKeys()
- {
- Collection<ProfileKey> keys = profileRepository.getProfileKeys();
- return keys;
- }
-
- /**
- * Always returns the default profile.
- */
- public Profile getProfile(ProfileKey key)
- throws NoSuchProfileException
- {
- if( profileRepository == null )
- throw new IllegalStateException("No profileRepository specified");
- if(profile != null)
- {
- if(key.isDefaultKey() || profile.getKey().equals(key))
- return profile;
- }
-
- // Obtain the deployment repository for the profile
- try
- {
- deploymentRepository = profileRepository.getProfileDeploymentRepository(key);
- }
- catch(NoSuchProfileException e)
- {
- throw e;
- }
- catch(Exception e)
- {
- throw new NoSuchProfileException("Failed to obtain deployment repository for: "+key, e);
- }
- log.info("Loading profile: "+name+" from: "+deploymentRepository);
- profile = new ProfileImpl(deploymentRepository, key);
- return profile;
- }
- public Profile getActiveProfile()
- throws NoSuchProfileException
- {
- return profile;
- }
-
- public String[] getProfileDeploymentNames(ProfileKey key)
- throws NoSuchProfileException
- {
- String[] names = {"default"};
- return names;
- }
-
- public ManagementView getViewManager()
- {
- return mgtView;
- }
- public void setViewManager(ManagementView mgtView)
- {
- this.mgtView = mgtView;
- }
-
- public DeploymentManager getDeploymentManager()
- {
- return deployMgr;
- }
- public void setDeploymentManager(DeploymentManager deployMgr)
- {
- this.deployMgr = deployMgr;
- }
-
- public Profile newProfile(ProfileKey key)
- throws Exception
- {
- DeploymentRepository repo = profileRepository.createProfileDeploymentRepository(key);
- return new ProfileImpl(repo, key);
- }
-
- public void removeProfile(ProfileKey key)
- throws Exception, NoSuchProfileException
- {
- profileRepository.removeProfileDeploymentRepository(key);
- }
-}
-
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileRepository;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profile.repository.ProfileImpl;
+
+
+/**
+ * A ProfileService impl that uses a ProfileRepository/DeploymentRepository
+ * based Profile implementation.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ProfileServiceImpl
+ implements ProfileService
+{
+ private static final Logger log = Logger.getLogger(ProfileServiceImpl.class);
+ /** The name of the profile to use */
+ private String name;
+ /** The profile repository plugin */
+ private ProfileRepository profileRepository;
+ /** The deployment repository plugin for the current profile */
+ private DeploymentRepository deploymentRepository;
+ /** The active profile */
+ private Profile profile;
+ /** The management view for the active profile */
+ private ManagementView mgtView;
+ /** The profiles DeploymentManager */
+ private DeploymentManager deployMgr;
+ /** The version of the profile to use */
+ private String version;
+
+ public ProfileServiceImpl(String name) throws IOException
+ {
+ this.name = name;
+ }
+ // Properties ------------------------
+
+ public String getName()
+ {
+ return this.name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String version)
+ {
+ this.version = version;
+ }
+
+ public ProfileRepository getProfileRepository()
+ {
+ return profileRepository;
+ }
+
+ public void setProfileRepository(ProfileRepository profileRepository)
+ {
+ this.profileRepository = profileRepository;
+ }
+
+ public DeploymentRepository getDeploymentRepository()
+ {
+ return deploymentRepository;
+ }
+
+ public void setDeploymentRepository(DeploymentRepository repository)
+ {
+ this.deploymentRepository = repository;
+ }
+
+ public void start()
+ throws Exception
+ {
+ if( profileRepository == null )
+ throw new IllegalStateException("No profileRepository specified");
+ // Obtain the deployment repository for the profile
+ ProfileKey key = new ProfileKey(name);
+ Profile profile = this.getProfile(key);
+ log.info("Loaded profile: "+profile);
+ }
+
+ // ProfileService implementation --------------------
+ /**
+ * There is only the default domain (ProfileKey.DEFAULT)
+ */
+ public String[] getDomains()
+ {
+ String[] domains = {ProfileKey.DEFAULT};
+ return domains;
+ }
+
+ /**
+ * Get the keys for all known profiles
+ * @return keys for all known profiles
+ */
+ public Collection<ProfileKey> getProfileKeys()
+ {
+ Collection<ProfileKey> keys = profileRepository.getProfileKeys();
+ return keys;
+ }
+
+ /**
+ * Always returns the default profile.
+ */
+ public Profile getProfile(ProfileKey key)
+ throws NoSuchProfileException
+ {
+ if( profileRepository == null )
+ throw new IllegalStateException("No profileRepository specified");
+ if(profile != null)
+ {
+ if(key.isDefaultKey() || profile.getKey().equals(key))
+ return profile;
+ }
+
+ // Obtain the deployment repository for the profile
+ try
+ {
+ deploymentRepository = profileRepository.getProfileDeploymentRepository(key);
+ }
+ catch(NoSuchProfileException e)
+ {
+ throw e;
+ }
+ catch(Exception e)
+ {
+ throw new NoSuchProfileException("Failed to obtain deployment repository for: "+key, e);
+ }
+ log.info("Loading profile: "+name+" from: "+deploymentRepository);
+ profile = new ProfileImpl(deploymentRepository, key);
+ return profile;
+ }
+ public Profile getActiveProfile()
+ throws NoSuchProfileException
+ {
+ return profile;
+ }
+
+ public String[] getProfileDeploymentNames(ProfileKey key)
+ throws NoSuchProfileException
+ {
+ String[] names = {"default"};
+ return names;
+ }
+
+ public ManagementView getViewManager()
+ {
+ return mgtView;
+ }
+ public void setViewManager(ManagementView mgtView)
+ {
+ this.mgtView = mgtView;
+ }
+
+ public DeploymentManager getDeploymentManager()
+ {
+ return deployMgr;
+ }
+ public void setDeploymentManager(DeploymentManager deployMgr)
+ {
+ this.deployMgr = deployMgr;
+ }
+
+ public Profile newProfile(ProfileKey key)
+ throws Exception
+ {
+ DeploymentRepository repo = profileRepository.createProfileDeploymentRepository(key);
+ return new ProfileImpl(repo, key);
+ }
+
+ public void removeProfile(ProfileKey key)
+ throws Exception, NoSuchProfileException
+ {
+ profileRepository.removeProfileDeploymentRepository(key);
+ }
+}
+
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,1346 +1,1346 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.SyncFailedException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.zip.ZipInputStream;
-
-import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.structure.ClassPathEntry;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-import org.jboss.profileservice.spi.DeploymentContentFlags;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
-import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
-import org.jboss.system.server.profileservice.attachments.DeploymentClassPathMetaData;
-import org.jboss.system.server.profileservice.attachments.DeploymentStructureMetaData;
-import org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects;
-import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
-import org.jboss.util.file.Files;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * An implementation of DeploymentRepository that relies on java
- * serialization to store contents on the file system.
- *
- * + root/{name}/bootstrap - the bootstrap beans
- * + root/{name}/deployers - profile deployers
- * + root/{name}/deploy - installed deployments
- * + root/{name}/apps - post install deployments
- * + root/{name}/attachments - pre-processed attachments + admin edits to deployments
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class SerializableDeploymentRepository
- implements DeploymentRepository
-{
- private static final Logger log = Logger.getLogger(SerializableDeploymentRepository.class);
-
- /** The server root container the deployments */
- private File root;
- /** The bootstrap descriptor dir */
- private File bootstrapDir;
- /** The server static libraries */
- private File libDir;
- /** The deployers phase deployments dir */
- private File deployersDir;
- /** The application phase deployments dir */
- private File[] applicationDirs;
- /** The application phase deployment files keyed by VirtualFile URI string */
- private final Map<String, VirtualFile> applicationVFCache = new HashMap<String, VirtualFile>();
- /** The deployment post edit root location */
- private File adminEditsRoot;
- /** The profile key this repository is associated with */
- private ProfileKey key;
- /** The bootstrap VFSDeployments */
- private LinkedHashMap<String,VFSDeployment> bootstrapCtxs = new LinkedHashMap<String,VFSDeployment>();
- /** The deployer VFSDeployments */
- private LinkedHashMap<String,VFSDeployment> deployerCtxs = new LinkedHashMap<String,VFSDeployment>();
- /** The application VFSDeployments */
- private LinkedHashMap<String,VFSDeployment> applicationCtxs = new LinkedHashMap<String,VFSDeployment>();
- /** The {@link VFSDeployment#PredeterminedManagedObjects} serializer */
- private AttachmentsSerializer serializer;
- private Map<String, Integer> contentFlags = new ConcurrentHashMap<String, Integer>();
- /** The last time the profile was modified */
- private long lastModified;
- /** A lock for the hot deployment/{@link #getModifiedDeployments()} */
- private ReentrantReadWriteLock contentLock = new ReentrantReadWriteLock(true);
- /** Should an attempt to overwrite existing content fail in {@link #addDeploymentContent(String, ZipInputStream, DeploymentPhase)}*/
- private boolean failIfAlreadyExists = false;
- /** The deployment factory */
- private VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
-
- public SerializableDeploymentRepository(File root, URI[] appURIs, ProfileKey key)
- {
- this.root = root;
- this.key = key;
- this.setApplicationURIs(appURIs);
- }
-
- public AttachmentsSerializer getSerializer()
- {
- return serializer;
- }
- public void setSerializer(AttachmentsSerializer serializer)
- {
- this.serializer = serializer;
- }
-
- public URI[] getApplicationURIs()
- {
- URI[] appURIs = new URI[applicationDirs.length];
- for (int n = 0; n < applicationDirs.length; n ++)
- {
- File applicationDir = applicationDirs[n];
- appURIs[n] = applicationDir.toURI();
- }
- return appURIs;
- }
- public void setApplicationURIs(URI[] uris)
- {
- applicationDirs = new File[uris.length];
- for (int n = 0; n < uris.length; n ++)
- {
- URI uri = uris[n];
- applicationDirs[n] = new File(uri);
- }
- }
-
- public boolean exists()
- {
- File profileRoot = new File(root, key.getName());
- return profileRoot.exists();
- }
-
- public long getLastModified()
- {
- return this.lastModified;
- }
-
- public URI getDeploymentURI(DeploymentPhase phase)
- {
- URI uri = null;
- switch( phase )
- {
- case BOOTSTRAP:
- uri = this.getBootstrapURI();
- break;
- case DEPLOYER:
- uri = this.getDeployersURI();
- break;
- case APPLICATION:
- uri = this.getApplicationURI();
- break;
- }
- return uri;
- }
-
- public void setDeploymentURI(URI uri, DeploymentPhase phase)
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.setBootstrapURI(uri);
- break;
- case DEPLOYER:
- this.setDeployersURI(uri);
- break;
- case APPLICATION:
- this.setApplicationURIs(new URI[]{uri});
- break;
- }
- }
- public Set<String> getDeploymentNames()
- {
- HashSet<String> names = new HashSet<String>();
- names.addAll(bootstrapCtxs.keySet());
- names.addAll(deployerCtxs.keySet());
- names.addAll(applicationCtxs.keySet());
- return names;
- }
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- HashSet<String> names = new HashSet<String>();
- switch( phase )
- {
- case BOOTSTRAP:
- names.addAll(this.bootstrapCtxs.keySet());
- break;
- case DEPLOYER:
- names.addAll(this.deployerCtxs.keySet());
- break;
- case APPLICATION:
- names.addAll(this.applicationCtxs.keySet());
- break;
- }
- return names;
- }
-
- /**
- *
- */
- public String addDeploymentContent(String name, InputStream contentIS, DeploymentPhase phase)
- throws IOException
- {
- boolean trace = log.isTraceEnabled();
- // Suspend hot deployment checking
- if( trace )
- log.trace("Aquiring content read lock");
- contentLock.writeLock().lock();
- String repositoryName = null;
- try
- {
- // Write the content out
- File contentRoot = getPhaseDir(phase);
- if(contentRoot == null)
- throw new FileNotFoundException("Failed to obtain content dir for phase: "+phase);
- File contentFile = new File(contentRoot, name);
- // TODO do we need to create the parent directory if the name is myDeployments/myRealDeployment.jar ?
-
- if(failIfAlreadyExists && contentFile.exists())
- throw new SyncFailedException("Deployment content already exists: "+contentFile.getAbsolutePath());
- FileOutputStream fos = new FileOutputStream(contentFile);
- try
- {
- byte[] tmp = new byte[4096];
- int read;
- while((read = contentIS.read(tmp)) > 0)
- {
- if (trace)
- log.trace("write, " + read);
- fos.write(tmp, 0, read);
- }
- fos.flush();
- // Get the vfs uri for the content as the repository name
- VirtualFile contentVF = VFS.getVirtualFile(contentRoot.toURI(), name);
- repositoryName = contentVF.getName();
- }
- finally
- {
- try
- {
- fos.close();
- }
- catch (IOException ignored)
- {
- }
- }
-
- // Lock the content
- lockDeploymentContent(name, phase);
- }
- finally
- {
- // Allow hot deployment checking
- contentLock.writeLock().unlock();
- if(trace)
- log.trace("Released content write lock");
- }
- return repositoryName;
- }
-
- /**
- * @throws URISyntaxException
- *
- */
- public VirtualFile getDeploymentContent(String name, DeploymentPhase phase)
- throws IOException, URISyntaxException
- {
- // find the cached root
- switch( phase )
- {
- case BOOTSTRAP:
- case DEPLOYER:
- throw new IOException(phase+" content access not supported");
- case APPLICATION:
- case APPLICATION_TRANSIENT:
- break;
- }
- // get cached version
- File contentRoot = getPhaseDir(phase);
- if(contentRoot == null)
- throw new FileNotFoundException("Failed to obtain content dir for phase: "+phase);
- File contentFile = new File(contentRoot, name);
- VirtualFile content = getCachedApplicationVF(contentFile);
- if(content == null || content.exists() == false)
- throw new FileNotFoundException("Failed to find content for: "+name);
- return content;
- }
-
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws IOException
- {
- List<String> tmp = new ArrayList<String>();
- URI rootURI = getDeploymentURI(phase);
- VirtualFile root = VFS.getRoot(rootURI);
- for(String name : names)
- {
- VirtualFile content = root.getChild(name);
- try
- {
- String rname = content.toURI().toString();
- tmp.add(rname);
- }
- catch (URISyntaxException e)
- {
- log.error("Should not happen", e);
- }
- }
- String[] rnames = new String[tmp.size()];
- tmp.toArray(rnames);
- return rnames;
- }
-
- public int lockDeploymentContent(String vfsPath, DeploymentPhase phase)
- {
- if( log.isTraceEnabled() )
- log.trace("lockDeploymentContent, "+vfsPath);
- int flags = setDeploymentContentFlags(vfsPath, phase, DeploymentContentFlags.LOCKED);
- return flags;
- }
-
- public int unlockDeploymentContent(String vfsPath, DeploymentPhase phase)
- {
- if( log.isTraceEnabled() )
- log.trace("unlockDeploymentContent, "+vfsPath);
- int flags = clearDeploymentContentFlags(vfsPath, phase, DeploymentContentFlags.LOCKED);
- return flags;
- }
-
- public int getDeploymentContentFlags(String vfsPath, DeploymentPhase phase)
- {
- Integer flags = contentFlags.get(vfsPath);
- int iflags = flags != null ? flags.intValue() : 0;
- return iflags;
- }
- public synchronized int clearDeploymentContentFlags(String vfsPath,
- DeploymentPhase phase,
- int flags)
- {
- Integer dflags = contentFlags.get(vfsPath);
- if(dflags != null)
- {
- dflags &= ~flags;
- contentFlags.put(vfsPath, dflags);
- }
- int iflags = dflags != null ? dflags.intValue() : 0;
- return iflags;
- }
- public boolean hasDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flag)
- {
- Integer flags = contentFlags.get(vfsPath);
- boolean hasFlag = false;
- if(flags != null )
- hasFlag = (flags & flag) != 0 ? true : false;
- return hasFlag;
- }
- public int setDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flags)
- {
- contentFlags.put(vfsPath, flags);
- return flags;
- }
-
- public void acquireDeploymentContentLock()
- {
- contentLock.writeLock().lock();
- if( log.isTraceEnabled() )
- log.trace("acquireDeploymentContentLock, have write lock");
- }
- public void releaseDeploymentContentLock()
- {
- contentLock.writeLock().unlock();
- if( log.isTraceEnabled() )
- log.trace("releaseDeploymentContentLock, gave up write lock");
- }
-
- public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.addBootstrap(vfsPath, d);
- break;
- case DEPLOYER:
- this.addDeployer(vfsPath, d);
- break;
- case APPLICATION:
- this.addApplication(vfsPath, d);
- break;
- case APPLICATION_TRANSIENT:
- this.addApplication(vfsPath, d);
- break;
- }
- lastModified = System.currentTimeMillis();
- }
-
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws Exception, NoSuchDeploymentException
- {
- VFSDeployment ctx = null;
- if( phase == null )
- {
- // Try all phases
- try
- {
- ctx = this.getBootstrap(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- try
- {
- if( ctx == null )
- ctx = this.getDeployer(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- try
- {
- if( ctx == null )
- ctx = this.getApplication(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- }
- else
- {
- switch( phase )
- {
- case BOOTSTRAP:
- ctx = this.getBootstrap(name);
- break;
- case DEPLOYER:
- ctx = this.getDeployer(name);
- break;
- case APPLICATION:
- ctx = this.getApplication(name);
- break;
- }
- }
- // Make sure we don't return null
- if( ctx == null )
- throw new NoSuchDeploymentException("name="+name+", phase="+phase);
- return ctx;
- }
-
- public Collection<VFSDeployment> getDeployments()
- {
- HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
- deployments.addAll(this.bootstrapCtxs.values());
- deployments.addAll(this.deployerCtxs.values());
- deployments.addAll(this.applicationCtxs.values());
- return Collections.unmodifiableCollection(deployments);
- }
-
- /**
- * Scan the applications for changes.
- */
- public synchronized Collection<ModificationInfo> getModifiedDeployments()
- throws Exception
- {
- ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
- Collection<VFSDeployment> apps = getApplications();
- boolean trace = log.isTraceEnabled();
- if( trace )
- log.trace("Checking applications for modifications");
- if( trace )
- log.trace("Aquiring content read lock");
- contentLock.readLock().lock();
- try
- {
- if( apps != null )
- {
- Iterator<VFSDeployment> iter = apps.iterator();
- int ignoreFlags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
- while( iter.hasNext() )
- {
- VFSDeployment ctx = iter.next();
- VirtualFile root = ctx.getRoot();
- String name = root.getPathName();
- // Ignore locked or disabled applications
- if(this.hasDeploymentContentFlags(name, DeploymentPhase.APPLICATION, ignoreFlags))
- {
- if(trace)
- log.trace("Ignoring locked application: "+root);
- continue;
- }
- // Check for removal
- if( root.exists() == false )
- {
- long rootLastModified = root.getLastModified();
- ModificationInfo info = new ModificationInfo(ctx, rootLastModified, ModifyStatus.REMOVED);
- modified.add(info);
- iter.remove();
- if( trace )
- log.trace(name + " was removed");
- }
- // Check for modification
- else if( hasBeenModified(root) ||
- hasDeploymentContentFlags(root.getPathName(), DeploymentPhase.APPLICATION, DeploymentContentFlags.MODIFIED) )
- {
- long rootLastModified = root.getLastModified();
- if( trace )
- log.trace(name + " was modified: " + rootLastModified);
- // Need to create a duplicate ctx
- VFSDeployment ctx2 = loadDeploymentData(root, DeploymentPhase.APPLICATION);
- ModificationInfo info = new ModificationInfo(ctx2, rootLastModified, ModifyStatus.MODIFIED);
- modified.add(info);
- }
- // TODO: this could check metadata files modifications as well
- }
- // Now check for additions
- for (File applicationDir : applicationDirs)
- {
- VirtualFile deployDir = getCachedApplicationVF(applicationDir);
- ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
- addedDeployments(added, deployDir);
- for(VirtualFile vf : added)
- {
- if(this.hasDeploymentContentFlags(vf.getPathName(), DeploymentPhase.APPLICATION, ignoreFlags))
- {
- if(trace)
- log.trace("Ignoring locked application: "+ vf);
- continue;
- }
- VFSDeployment ctx = loadDeploymentData(vf, DeploymentPhase.APPLICATION);
- ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
- modified.add(info);
- applicationCtxs.put(ctx.getName(), ctx);
- }
- }
- }
- }
- finally
- {
- contentLock.readLock().unlock();
- if( trace )
- log.trace("Released content read lock");
- }
-
- if(modified.size() > 0)
- lastModified = System.currentTimeMillis();
- return modified;
- }
-
- /**
- * Has the root been modified.
- *
- * @param root the virtual file root
- * @return true if modifed
- * @throws Exception for any error
- */
- protected boolean hasBeenModified(VirtualFile root) throws Exception
- {
- return root.hasBeenModified();
- }
-
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- throws Exception
- {
- Collection<VFSDeployment> ctxs = null;
- switch( phase )
- {
- case BOOTSTRAP:
- ctxs = this.getBootstraps();
- break;
- case DEPLOYER:
- ctxs = this.getDeployers();
- break;
- case APPLICATION:
- ctxs = this.getApplications();
- break;
- }
- return ctxs;
- }
-
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- VFSDeployment ctx = null;
- switch( phase )
- {
- case BOOTSTRAP:
- ctx = this.removeBootstrap(name);
- break;
- case DEPLOYER:
- ctx = this.removeDeployer(name);
- break;
- case APPLICATION:
- ctx = this.removeApplication(name);
- break;
- }
- if(ctx != null)
- lastModified = System.currentTimeMillis();
- return ctx;
- }
-
- public String toString()
- {
- StringBuilder tmp = new StringBuilder(super.toString());
- tmp.append("(root=");
- tmp.append(root);
- tmp.append(", key=");
- tmp.append(key);
- tmp.append(")");
- return tmp.toString();
- }
-
- /**
- * Create a profile deployment repository
- *
- * @throws IOException
- */
- public void create() throws Exception
- {
- File profileRoot = new File(root, key.getName());
- if( profileRoot.exists() == true )
- throw new IOException("Profile root already exists: "+profileRoot);
- if( profileRoot.mkdirs() == false )
- throw new IOException("Failed to create profile root: "+profileRoot);
- // server/{name}/bootstrap
- bootstrapDir = new File(profileRoot, "bootstrap");
- if( bootstrapDir.mkdirs() == false )
- throw new IOException("Failed to create profile bootstrap dir: "+bootstrapDir);
-
- // server/{name}/deployers
- deployersDir = new File(profileRoot, "deployers");
- if( deployersDir.mkdirs() == false )
- throw new IOException("Failed to create profile deployers dir: "+deployersDir);
-
- // server/{name}/deploy
- for (File applicationDir : applicationDirs)
- {
- if( applicationDir.mkdirs() == false )
- throw new IOException("Failed to create profile deploy dir: "+applicationDir);
- }
- // server/{name}/lib
- libDir = new File(profileRoot, "lib");
- if( libDir.mkdirs() == false )
- throw new IOException("Failed to create profile lib dir: "+libDir);
-
- adminEditsRoot = new File(profileRoot, "attachments");
- if( adminEditsRoot.mkdirs() == false )
- throw new IOException("Failed to create profile adminEdits dir: "+adminEditsRoot);
- }
-
- /**
- * Load the profile deployments
- *
- * @throws IOException
- * @throws NoSuchProfileException
- */
- public void load() throws Exception, NoSuchProfileException
- {
- if( serializer == null )
- throw new IllegalStateException("serializer has not been set");
-
- File profileRoot = new File(root, key.getName());
- if( profileRoot.exists() == false )
- throw new NoSuchProfileException("Profile root does not exists: "+profileRoot);
- // server/{name}/bootstrap
- bootstrapDir = new File(profileRoot, "bootstrap");
- if( bootstrapDir.exists() == false )
- {
- //throw new FileNotFoundException("Profile contains no bootstrap dir: "+bootstrapDir);
- // fallback to conf/jboss-service.xml for now
- bootstrapDir = null;
- }
-
- // server/{name}/deployers
- deployersDir = new File(profileRoot, "deployers");
- if( deployersDir.exists() == false )
- throw new FileNotFoundException("Profile contains no deployers dir: "+deployersDir);
-
- // server/{name}/deploy
- for (File applicationDir : applicationDirs)
- {
- if( applicationDir.exists() == false )
- throw new FileNotFoundException("Profile contains no deploy dir: "+applicationDir);
- }
-
- adminEditsRoot = new File(profileRoot, "attachments");
- if(this.serializer instanceof AbstractFileAttachmentsSerializer)
- ((AbstractFileAttachmentsSerializer) this.serializer).setAttachmentsStoreDir(adminEditsRoot);
-
- if( bootstrapDir != null )
- {
- VFS bootstrapVFS = VFS.getVFS(bootstrapDir.toURI());
- loadBootstraps(bootstrapVFS.getRoot());
- }
- else
- {
- // hack to load conf/jboss-service.xml until its removed
- loadBootstraps(null);
- }
- VFS deployersVFS = VFS.getVFS(deployersDir.toURI());
- loadDeployers(deployersVFS.getRoot());
- for (File applicationDir : applicationDirs)
- {
- VirtualFile dirVF = getCachedApplicationVF(applicationDir);
- loadApplications(dirVF);
- }
-
- this.lastModified = System.currentTimeMillis();
- }
-
- /**
- * Get virtual file for app dir.
- *
- * @param applicationDir the app dir
- * @return virtual file representing app dir
- * @throws IOException for any error
- */
- protected VirtualFile getCachedApplicationVF(File applicationDir) throws IOException
- {
- URI uri = applicationDir.toURI();
- return getCachedApplicationVF(uri);
- }
-
- /**
- * Get virtual file for app uri.
- *
- * @param uri the app uri
- * @return virtual file representing app uri
- * @throws IOException for any error
- */
- protected VirtualFile getCachedApplicationVF(URI uri) throws IOException
- {
- String uriString = uri.toString();
- VirtualFile dir;
- synchronized (applicationVFCache)
- {
- dir = applicationVFCache.get(uriString);
- if (dir == null)
- {
- dir = VFS.getCachedFile(uri);
- applicationVFCache.put(uriString, dir);
- }
- }
- return dir;
- }
-
- /**
- * Remove the contents of the profile repository
- * @throws IOException
- * @throws NoSuchProfileException
- */
- public void remove() throws IOException, NoSuchProfileException
- {
- File profileRoot = new File(root, key.getName());
- Files.delete(profileRoot);
- }
-
- protected void addBootstrap(String vfsPath, VFSDeployment ctx)
- throws Exception
- {
- this.bootstrapCtxs.put(vfsPath, ctx);
- }
-
- // Managed object attachments for a deployment
- public void addManagedObject(String vfsPath, Attachments edits)
- throws IOException
- {
- // TODO what should this do ?
- throw new UnsupportedOperationException("addManagedObject");
-// Map<String, Object> map = edits.getAttachments();
-// File attachments = new File(adminEditsRoot, vfsPath+".edits");
-// ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(attachments));
-// try
-// {
-// oos.writeObject(map);
-// }
-// finally
-// {
-// try
-// {
-// oos.close();
-// }
-// catch (IOException ignore)
-// {
-// }
-// }
-// lastModified = System.currentTimeMillis();
- }
-
- protected void addDeployer(String vfsPath, VFSDeployment ctx)
- throws Exception
- {
- this.deployerCtxs.put(vfsPath, ctx);
- }
-
- protected void addApplication(String vfsPath, VFSDeployment ctx) throws Exception
- {
- log.info("Adding application: " + vfsPath + " / " + ctx);
- this.applicationCtxs.put(vfsPath, ctx);
- }
-
- protected VFSDeployment getBootstrap(String vfsPath) throws Exception
- {
- VFSDeployment ctx = bootstrapCtxs.get(vfsPath);
- if( ctx == null )
- throw new NoSuchDeploymentException(vfsPath);
- return ctx;
- }
-
- protected Collection<VFSDeployment> getBootstraps() throws Exception
- {
- return bootstrapCtxs.values();
- }
-
- protected File getPhaseDir(DeploymentPhase phase)
- {
- File dir = null;
- switch( phase )
- {
- case BOOTSTRAP:
- dir = bootstrapDir;
- break;
- case DEPLOYER:
- dir = deployersDir;
- break;
- case APPLICATION:
- dir = applicationDirs[0];
- break;
- case APPLICATION_TRANSIENT:
- // TODO
- break;
- }
- return dir;
- }
-
- protected URI getBootstrapURI()
- {
- return bootstrapDir.toURI();
- }
- protected URI getDeployersURI()
- {
- return deployersDir.toURI();
- }
- protected URI getApplicationURI()
- {
- File applicationDir = applicationDirs[0];
- return applicationDir.toURI();
- }
- protected VFSDeployment getDeployer(String vfsPath)
- throws Exception
- {
- VFSDeployment ctx = deployerCtxs.get(vfsPath);
- if( ctx == null )
- throw new NoSuchDeploymentException(vfsPath);
- return ctx;
- }
-
- protected Collection<VFSDeployment> getDeployers()
- throws Exception
- {
- return deployerCtxs.values();
- }
-
- protected VFSDeployment getApplication(String vfsPath) throws Exception
- {
- boolean trace = log.isTraceEnabled();
- VFSDeployment ctx = applicationCtxs.get(vfsPath);
- if( ctx == null )
- {
- // Try to find the simple name
- if(trace)
- log.trace("Failed to find application for: "+vfsPath+", scanning for simple name");
- for(VFSDeployment deployment : applicationCtxs.values())
- {
- if(trace)
- log.trace("Checking: "+deployment.getSimpleName());
- if(deployment.getSimpleName().equals(vfsPath))
- {
- if(trace)
- log.trace("Matched to simple name of deployment:"+deployment);
- ctx = deployment;
- break;
- }
- }
- if(ctx == null)
- {
- log.debug("Failed to find application for: "+vfsPath+", available: " + applicationCtxs.values());
- throw new NoSuchDeploymentException(vfsPath);
- }
- }
- return ctx;
- }
-
- protected Collection<VFSDeployment> getApplications()
- throws Exception
- {
- return applicationCtxs.values();
- }
-
- protected VFSDeployment removeBootstrap(String vfsPath) throws IOException
- {
- VFSDeployment vfsDeployment = bootstrapCtxs.get(vfsPath);
- if(vfsDeployment == null)
- throw new IllegalStateException("Deployment not found: " + vfsPath + ", available: " + bootstrapCtxs.values());
- VirtualFile root = vfsDeployment.getRoot();
- if(root.delete() == false)
- throw new IOException("Failed to delete: " + root);
- return bootstrapCtxs.remove(vfsPath);
- }
-
- // this is an infinite loop
- protected VFSDeployment removeDeployer(String vfsPath) throws IOException
- {
- VFSDeployment vfsDeployment = deployerCtxs.get(vfsPath);
- if(vfsDeployment == null)
- throw new IllegalStateException("Deployment not found: " + vfsPath + ", available: " + deployerCtxs.values());
- VirtualFile root = vfsDeployment.getRoot();
- if(root.delete() == false)
- throw new IOException("Failed to delete: " + root);
- return deployerCtxs.remove(vfsPath);
- }
- protected VFSDeployment removeApplication(String vfsPath) throws Exception
- {
- VFSDeployment vfsDeployment = getApplication(vfsPath);
- VirtualFile root = vfsDeployment.getRoot();
- if(root.delete() == false)
- throw new IOException("Failed to delete: " + root);
- return this.applicationCtxs.remove(vfsPath);
- }
- protected void setBootstrapURI(URI uri)
- {
- bootstrapDir = new File(uri);
- }
- protected void setDeployersURI(URI uri)
- {
- deployersDir = new File(uri);
- }
-
- /**
- * Load the bootstrap descriptors under bootstrapDir:
- *
- * @param bootstrapDir
- * @throws IOException
- */
- private void loadBootstraps(VirtualFile bootstrapDir)
- throws IOException
- {
- if( bootstrapDir != null )
- {
- List<VirtualFile> children = bootstrapDir.getChildren();
- for(VirtualFile vf : children)
- {
- VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.BOOTSTRAP);
- bootstrapCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
- else
- {
- // fallback to conf/jboss-service.xml for now
- File profileRoot = new File(root, key.getName());
- File confDir = new File(profileRoot, "conf");
- VirtualFile confVF = VFS.getRoot(confDir.toURI());
- VirtualFile jbossServiceVF = confVF.getChild("jboss-service.xml");
- if(jbossServiceVF == null)
- throw new FileNotFoundException("Failed to find jboss-service.xml under conf");
- VFSDeployment vfCtx = loadDeploymentData(jbossServiceVF, DeploymentPhase.BOOTSTRAP);
- bootstrapCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
-
- /**
- * Load all the deployments under the deployersDir.
- *
- * @param deployersDir
- * @throws IOException
- */
- private void loadDeployers(VirtualFile deployersDir)
- throws IOException
- {
- List<VirtualFile> children = deployersDir.getChildren();
- for(VirtualFile vf : children)
- {
- VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.DEPLOYER);
- deployerCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
-
- /**
- * Load all the applications under the applicationDir.
- *
- * @param applicationDir
- * @throws IOException
- */
- private void loadApplications(VirtualFile applicationDir)
- throws Exception
- {
- ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
- addedDeployments(added, applicationDir);
- for (VirtualFile vf : added)
- {
- VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.APPLICATION);
- applicationCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
-
- /**
- * Added deployments for DeploymentPhase.APPLICATION.
- *
- * @param list
- * @param root
- * @throws Exception
- */
- private void addedDeployments(List<VirtualFile> list, VirtualFile root)
- throws Exception
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile component : components)
- {
- String key = component.toURI().toString();
- if (applicationCtxs.containsKey(key) == true)
- continue;
-
- if (component.isLeaf())
- {
- list.add(component);
- }
- else if (component.getName().indexOf('.') == -1)
- {
- // recurse if not '.' in name and recursive search is enabled
- addedDeployments(list, component);
- }
- else
- {
- list.add(component);
- }
- }
- }
-
- /**
- * TODO Map<String, Object should not be required ?
- */
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- Map<String, Object> attachments) throws Exception
- {
- RepositoryAttachmentMetaData metaData = (RepositoryAttachmentMetaData) attachments.get(RepositoryAttachmentMetaData.class.getName());
- if(metaData != null)
- {
- this.updateDeployment(d, phase, metaData);
- }
- else
- {
- log.error("no metadata attached.");
- }
- }
-
- /**
- * Update a deployment based on it's RepositoryAttachmentMetaData
- *
- * TODO use a xml serializer, to drop the use of the childAttachment maps.
- *
- * @param d
- * @param phase
- * @param metaData
- * @throws Exception
- */
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- RepositoryAttachmentMetaData metaData)
- throws Exception
- {
- boolean trace = log.isTraceEnabled();
-
- // The PhaseDir
- File path = getPhaseDir(phase);
- if(path == null)
- {
- log.warn("Could not get PhaseDir for DeploymentPhase: " + phase + ", unable to perstisted attachments.");
- return;
- }
-
- // attachments/deploy/deployment/
- String deploymentPath = path.getName() + File.separator + d.getSimpleName() + File.separator;
- RepositoryAttachmentMetaData savedMetaData = loadAttachmentMetaData(deploymentPath);
-
- if(savedMetaData != null)
- {
- if(trace)
- log.trace("Previous metadata found for deployment: " + d);
- // TODO merge updates
- }
-
- // Save attachments for the root context
- if(metaData.getAttachments() != null && !metaData.getAttachments().isEmpty())
- {
- for(AttachmentMetaData attachment : metaData.getAttachments())
- {
- String attachmentPath = deploymentPath + attachment.getName();
- // Serialize the attachment
- serializer.saveAttachment(attachmentPath, attachment.getAttachment());
-
- if(trace)
- log.trace("Stored attachment to : " + attachmentPath);
- }
- }
-
- // Save attachments for the children
- List<RepositoryAttachmentMetaData> children = metaData.getChildren();
- if(children != null && !children.isEmpty())
- {
- for(RepositoryAttachmentMetaData child : children)
- {
- // The relative child path
- String childPath = deploymentPath + child.getDeploymentName() + File.separator;
- if(child.getAttachments() != null && ! child.getAttachments().isEmpty())
- {
- for(AttachmentMetaData attachment : child.getAttachments())
- {
- String attachmentPath = childPath + attachment.getName();
- // Serialize the attachment
- serializer.saveAttachment(attachmentPath, attachment.getAttachment());
-
- if(trace)
- log.trace("Stored attachment to : " + attachmentPath);
- }
- }
- }
- }
-
- // Store the repository metadata
- this.serializer.saveAttachment(deploymentPath + "metadata", metaData);
-
- //
- this.lastModified = System.currentTimeMillis();
- }
-
- /**
- * Load the attachment metadata.
- *
- * @param file
- * @return the deployment
- */
- private VFSDeployment loadDeploymentData(VirtualFile file, DeploymentPhase phase)
- {
- boolean trace = log.isTraceEnabled();
- // Create VFS deployment
- VFSDeployment deployment = factory.createVFSDeployment(file);
- if(trace)
- log.trace("Created deployment: " + deployment);
-
- // The PhaseDir
- File path = getPhaseDir(phase);
- if(path == null)
- {
- log.debug("Could not get PhaseDir for DeploymentPhase: " + phase + ", do not scann for perstisted attachments.");
- return deployment;
- }
-
-
- // attachments/deploy/deployment/
- String deploymentPath = path.getName() + File.separator + deployment.getSimpleName() + File.separator;
- if(trace)
- log.trace("trying to load attachment from relative path: " + deploymentPath);
-
- // Load the metadata
- RepositoryAttachmentMetaData attachmentMetaData = loadAttachmentMetaData(deploymentPath);
-
- if(attachmentMetaData == null)
- {
- if(trace)
- log.trace("Did not find any presisted metadata for deployment: " + deployment);
- return deployment;
- }
-
- try
- {
- // If the deployment has changes we skip this.
- // TODO delete attachments ?
- if(attachmentMetaData.getLastModified() < file.getLastModified())
- {
- log.debug("Not using the persisted metadata, as the deployment was modified.");
- return deployment;
- }
- }
- catch(IOException e)
- {
- log.error("failed to get LastModified date for file, no using persisted metadata: "+ file.getPathName());
- return deployment;
- }
-
- // Start with "" the root contextPath
- rebuildStructureContext(deployment, "", deploymentPath, attachmentMetaData, trace);
-
- return deployment;
- }
-
- /**
- * Rebuild the StructureMetaData based on the RepositoryAttachmentMetaData
- * and add predeterminedManagedObjects.
- *
- * @param deployment the VFSDeployment
- * @param contextName the structure context path
- * @param deploymentPath the path to the attachement
- * @param attachmentMetaData the meta data
- */
- protected void rebuildStructureContext(VFSDeployment deployment,
- String contextName,
- String deploymentPath,
- RepositoryAttachmentMetaData attachmentMetaData,
- boolean trace)
- {
- // The toplevel context
- boolean isRoot = "".equals(contextName);
-
- if(trace)
- log.trace("Rebuilding StructureMetaData for context: " + contextName);
-
-
-
- // Get the stored deployment structure
- DeploymentStructureMetaData structure = attachmentMetaData.getDeploymentStructure();
-
- // MetaData and ClassPath
- List<String> metaDataPaths = new ArrayList<String>();
- List<ClassPathEntry> classPath = new ArrayList<ClassPathEntry>();
- if(structure != null)
- {
- if(structure.getClassPaths() != null)
- {
- for(DeploymentClassPathMetaData md : structure.getClassPaths())
- classPath.add(factory.createClassPathEntry(md.getPath(), md.getSuffixes()));
- }
-
- if(structure.getMetaDataPaths() != null)
- metaDataPaths = structure.getMetaDataPaths();
- }
-
- // Now create the ContextInfo
- ContextInfo info = factory.addContext(deployment, contextName, metaDataPaths, classPath);
- if(structure != null)
- {
- // Set the comparator
- info.setComparatorClassName(structure.getComparatorClass());
- // Set the relative order
- info.setRelativeOrder(structure.getRelatativeOrder());
- }
- if(trace)
- log.trace("created ContextInfo: "+ info + " for deployment: "+ deployment);
-
- // Add attachments if needed
- if(attachmentMetaData.getAttachments() != null && ! attachmentMetaData.getAttachments().isEmpty())
- {
- Set<String> availableAttachments = new HashSet<String>();
- for(AttachmentMetaData attachment : attachmentMetaData.getAttachments())
- availableAttachments.add(attachment.getName());
-
- MutableAttachments mutable = new LazyPredeterminedManagedObjects(this.serializer, deploymentPath, availableAttachments);
-
- // TODO is there a better way to do this ?
- if(isRoot)
- deployment.setPredeterminedManagedObjects(mutable);
- else
- info.setPredeterminedManagedObjects(mutable);
-
- if(trace)
- log.trace("Added PredetminedManagedObjects: " + availableAttachments + " to context " + contextName);
- }
- else
- {
- if(trace)
- log.trace("No PredetminedManagedObjects found for context " + contextName);
- }
-
- // Process children
- List<RepositoryAttachmentMetaData> children = attachmentMetaData.getChildren();
- if(children != null && ! children.isEmpty())
- {
- for(RepositoryAttachmentMetaData childMetaData : children)
- {
- // The structure context path
- String childContextName = contextName + "/" + childMetaData.getDeploymentName();
- // The relative path of the child attachment (therefore File.separator)
- String relativePath = deploymentPath + childMetaData.getDeploymentName() + File.separator;
-
- if(trace)
- log.trace("Processing child context: "+ childContextName);
-
- // Rebuild the structure of the child
- rebuildStructureContext(deployment, childContextName, relativePath, childMetaData, trace);
- }
- }
- }
-
- /**
- * Load the attachment metadata for a deployment.
- *
- * @param relativeDeploymentPath the relatative path to the metadata
- * @return the attachment metadata
- */
- protected RepositoryAttachmentMetaData loadAttachmentMetaData(String relativeDeploymentPath)
- {
- final String metaDataName = "metadata";
- // attachments/deploy/deployment/metadata
- String fixedMetadataPath = relativeDeploymentPath.endsWith(File.separator) ? relativeDeploymentPath + metaDataName : relativeDeploymentPath + File.separator + metaDataName;
-
- try
- {
- // Try to load metadata Attachment
- return this.serializer.loadAttachment(fixedMetadataPath, RepositoryAttachmentMetaData.class);
- }
- catch(Exception e)
- {
- log.error("Failed to load attachment metadata from relative path: "+ relativeDeploymentPath, e);
- }
- return null;
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.server.profileservice.repository;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.SyncFailedException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.AttachmentsSerializer;
+import org.jboss.profileservice.spi.DeploymentContentFlags;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
+import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
+import org.jboss.system.server.profileservice.attachments.DeploymentClassPathMetaData;
+import org.jboss.system.server.profileservice.attachments.DeploymentStructureMetaData;
+import org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects;
+import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
+import org.jboss.util.file.Files;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * An implementation of DeploymentRepository that relies on java
+ * serialization to store contents on the file system.
+ *
+ * + root/{name}/bootstrap - the bootstrap beans
+ * + root/{name}/deployers - profile deployers
+ * + root/{name}/deploy - installed deployments
+ * + root/{name}/apps - post install deployments
+ * + root/{name}/attachments - pre-processed attachments + admin edits to deployments
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class SerializableDeploymentRepository
+ implements DeploymentRepository
+{
+ private static final Logger log = Logger.getLogger(SerializableDeploymentRepository.class);
+
+ /** The server root container the deployments */
+ private File root;
+ /** The bootstrap descriptor dir */
+ private File bootstrapDir;
+ /** The server static libraries */
+ private File libDir;
+ /** The deployers phase deployments dir */
+ private File deployersDir;
+ /** The application phase deployments dir */
+ private File[] applicationDirs;
+ /** The application phase deployment files keyed by VirtualFile URI string */
+ private final Map<String, VirtualFile> applicationVFCache = new HashMap<String, VirtualFile>();
+ /** The deployment post edit root location */
+ private File adminEditsRoot;
+ /** The profile key this repository is associated with */
+ private ProfileKey key;
+ /** The bootstrap VFSDeployments */
+ private LinkedHashMap<String,VFSDeployment> bootstrapCtxs = new LinkedHashMap<String,VFSDeployment>();
+ /** The deployer VFSDeployments */
+ private LinkedHashMap<String,VFSDeployment> deployerCtxs = new LinkedHashMap<String,VFSDeployment>();
+ /** The application VFSDeployments */
+ private LinkedHashMap<String,VFSDeployment> applicationCtxs = new LinkedHashMap<String,VFSDeployment>();
+ /** The {@link VFSDeployment#PredeterminedManagedObjects} serializer */
+ private AttachmentsSerializer serializer;
+ private Map<String, Integer> contentFlags = new ConcurrentHashMap<String, Integer>();
+ /** The last time the profile was modified */
+ private long lastModified;
+ /** A lock for the hot deployment/{@link #getModifiedDeployments()} */
+ private ReentrantReadWriteLock contentLock = new ReentrantReadWriteLock(true);
+ /** Should an attempt to overwrite existing content fail in {@link #addDeploymentContent(String, ZipInputStream, DeploymentPhase)}*/
+ private boolean failIfAlreadyExists = false;
+ /** The deployment factory */
+ private VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
+
+ public SerializableDeploymentRepository(File root, URI[] appURIs, ProfileKey key)
+ {
+ this.root = root;
+ this.key = key;
+ this.setApplicationURIs(appURIs);
+ }
+
+ public AttachmentsSerializer getSerializer()
+ {
+ return serializer;
+ }
+ public void setSerializer(AttachmentsSerializer serializer)
+ {
+ this.serializer = serializer;
+ }
+
+ public URI[] getApplicationURIs()
+ {
+ URI[] appURIs = new URI[applicationDirs.length];
+ for (int n = 0; n < applicationDirs.length; n ++)
+ {
+ File applicationDir = applicationDirs[n];
+ appURIs[n] = applicationDir.toURI();
+ }
+ return appURIs;
+ }
+ public void setApplicationURIs(URI[] uris)
+ {
+ applicationDirs = new File[uris.length];
+ for (int n = 0; n < uris.length; n ++)
+ {
+ URI uri = uris[n];
+ applicationDirs[n] = new File(uri);
+ }
+ }
+
+ public boolean exists()
+ {
+ File profileRoot = new File(root, key.getName());
+ return profileRoot.exists();
+ }
+
+ public long getLastModified()
+ {
+ return this.lastModified;
+ }
+
+ public URI getDeploymentURI(DeploymentPhase phase)
+ {
+ URI uri = null;
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ uri = this.getBootstrapURI();
+ break;
+ case DEPLOYER:
+ uri = this.getDeployersURI();
+ break;
+ case APPLICATION:
+ uri = this.getApplicationURI();
+ break;
+ }
+ return uri;
+ }
+
+ public void setDeploymentURI(URI uri, DeploymentPhase phase)
+ {
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ this.setBootstrapURI(uri);
+ break;
+ case DEPLOYER:
+ this.setDeployersURI(uri);
+ break;
+ case APPLICATION:
+ this.setApplicationURIs(new URI[]{uri});
+ break;
+ }
+ }
+ public Set<String> getDeploymentNames()
+ {
+ HashSet<String> names = new HashSet<String>();
+ names.addAll(bootstrapCtxs.keySet());
+ names.addAll(deployerCtxs.keySet());
+ names.addAll(applicationCtxs.keySet());
+ return names;
+ }
+ public Set<String> getDeploymentNames(DeploymentPhase phase)
+ {
+ HashSet<String> names = new HashSet<String>();
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ names.addAll(this.bootstrapCtxs.keySet());
+ break;
+ case DEPLOYER:
+ names.addAll(this.deployerCtxs.keySet());
+ break;
+ case APPLICATION:
+ names.addAll(this.applicationCtxs.keySet());
+ break;
+ }
+ return names;
+ }
+
+ /**
+ *
+ */
+ public String addDeploymentContent(String name, InputStream contentIS, DeploymentPhase phase)
+ throws IOException
+ {
+ boolean trace = log.isTraceEnabled();
+ // Suspend hot deployment checking
+ if( trace )
+ log.trace("Aquiring content read lock");
+ contentLock.writeLock().lock();
+ String repositoryName = null;
+ try
+ {
+ // Write the content out
+ File contentRoot = getPhaseDir(phase);
+ if(contentRoot == null)
+ throw new FileNotFoundException("Failed to obtain content dir for phase: "+phase);
+ File contentFile = new File(contentRoot, name);
+ // TODO do we need to create the parent directory if the name is myDeployments/myRealDeployment.jar ?
+
+ if(failIfAlreadyExists && contentFile.exists())
+ throw new SyncFailedException("Deployment content already exists: "+contentFile.getAbsolutePath());
+ FileOutputStream fos = new FileOutputStream(contentFile);
+ try
+ {
+ byte[] tmp = new byte[4096];
+ int read;
+ while((read = contentIS.read(tmp)) > 0)
+ {
+ if (trace)
+ log.trace("write, " + read);
+ fos.write(tmp, 0, read);
+ }
+ fos.flush();
+ // Get the vfs uri for the content as the repository name
+ VirtualFile contentVF = VFS.getVirtualFile(contentRoot.toURI(), name);
+ repositoryName = contentVF.getName();
+ }
+ finally
+ {
+ try
+ {
+ fos.close();
+ }
+ catch (IOException ignored)
+ {
+ }
+ }
+
+ // Lock the content
+ lockDeploymentContent(name, phase);
+ }
+ finally
+ {
+ // Allow hot deployment checking
+ contentLock.writeLock().unlock();
+ if(trace)
+ log.trace("Released content write lock");
+ }
+ return repositoryName;
+ }
+
+ /**
+ * @throws URISyntaxException
+ *
+ */
+ public VirtualFile getDeploymentContent(String name, DeploymentPhase phase)
+ throws IOException, URISyntaxException
+ {
+ // find the cached root
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ case DEPLOYER:
+ throw new IOException(phase+" content access not supported");
+ case APPLICATION:
+ case APPLICATION_TRANSIENT:
+ break;
+ }
+ // get cached version
+ File contentRoot = getPhaseDir(phase);
+ if(contentRoot == null)
+ throw new FileNotFoundException("Failed to obtain content dir for phase: "+phase);
+ File contentFile = new File(contentRoot, name);
+ VirtualFile content = getCachedApplicationVF(contentFile);
+ if(content == null || content.exists() == false)
+ throw new FileNotFoundException("Failed to find content for: "+name);
+ return content;
+ }
+
+ public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws IOException
+ {
+ List<String> tmp = new ArrayList<String>();
+ URI rootURI = getDeploymentURI(phase);
+ VirtualFile root = VFS.getRoot(rootURI);
+ for(String name : names)
+ {
+ VirtualFile content = root.getChild(name);
+ try
+ {
+ String rname = content.toURI().toString();
+ tmp.add(rname);
+ }
+ catch (URISyntaxException e)
+ {
+ log.error("Should not happen", e);
+ }
+ }
+ String[] rnames = new String[tmp.size()];
+ tmp.toArray(rnames);
+ return rnames;
+ }
+
+ public int lockDeploymentContent(String vfsPath, DeploymentPhase phase)
+ {
+ if( log.isTraceEnabled() )
+ log.trace("lockDeploymentContent, "+vfsPath);
+ int flags = setDeploymentContentFlags(vfsPath, phase, DeploymentContentFlags.LOCKED);
+ return flags;
+ }
+
+ public int unlockDeploymentContent(String vfsPath, DeploymentPhase phase)
+ {
+ if( log.isTraceEnabled() )
+ log.trace("unlockDeploymentContent, "+vfsPath);
+ int flags = clearDeploymentContentFlags(vfsPath, phase, DeploymentContentFlags.LOCKED);
+ return flags;
+ }
+
+ public int getDeploymentContentFlags(String vfsPath, DeploymentPhase phase)
+ {
+ Integer flags = contentFlags.get(vfsPath);
+ int iflags = flags != null ? flags.intValue() : 0;
+ return iflags;
+ }
+ public synchronized int clearDeploymentContentFlags(String vfsPath,
+ DeploymentPhase phase,
+ int flags)
+ {
+ Integer dflags = contentFlags.get(vfsPath);
+ if(dflags != null)
+ {
+ dflags &= ~flags;
+ contentFlags.put(vfsPath, dflags);
+ }
+ int iflags = dflags != null ? dflags.intValue() : 0;
+ return iflags;
+ }
+ public boolean hasDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
+ int flag)
+ {
+ Integer flags = contentFlags.get(vfsPath);
+ boolean hasFlag = false;
+ if(flags != null )
+ hasFlag = (flags & flag) != 0 ? true : false;
+ return hasFlag;
+ }
+ public int setDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
+ int flags)
+ {
+ contentFlags.put(vfsPath, flags);
+ return flags;
+ }
+
+ public void acquireDeploymentContentLock()
+ {
+ contentLock.writeLock().lock();
+ if( log.isTraceEnabled() )
+ log.trace("acquireDeploymentContentLock, have write lock");
+ }
+ public void releaseDeploymentContentLock()
+ {
+ contentLock.writeLock().unlock();
+ if( log.isTraceEnabled() )
+ log.trace("releaseDeploymentContentLock, gave up write lock");
+ }
+
+ public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
+ throws Exception
+ {
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ this.addBootstrap(vfsPath, d);
+ break;
+ case DEPLOYER:
+ this.addDeployer(vfsPath, d);
+ break;
+ case APPLICATION:
+ this.addApplication(vfsPath, d);
+ break;
+ case APPLICATION_TRANSIENT:
+ this.addApplication(vfsPath, d);
+ break;
+ }
+ lastModified = System.currentTimeMillis();
+ }
+
+ public VFSDeployment getDeployment(String name, DeploymentPhase phase)
+ throws Exception, NoSuchDeploymentException
+ {
+ VFSDeployment ctx = null;
+ if( phase == null )
+ {
+ // Try all phases
+ try
+ {
+ ctx = this.getBootstrap(name);
+ }
+ catch(NoSuchDeploymentException ignore)
+ {
+ }
+ try
+ {
+ if( ctx == null )
+ ctx = this.getDeployer(name);
+ }
+ catch(NoSuchDeploymentException ignore)
+ {
+ }
+ try
+ {
+ if( ctx == null )
+ ctx = this.getApplication(name);
+ }
+ catch(NoSuchDeploymentException ignore)
+ {
+ }
+ }
+ else
+ {
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ ctx = this.getBootstrap(name);
+ break;
+ case DEPLOYER:
+ ctx = this.getDeployer(name);
+ break;
+ case APPLICATION:
+ ctx = this.getApplication(name);
+ break;
+ }
+ }
+ // Make sure we don't return null
+ if( ctx == null )
+ throw new NoSuchDeploymentException("name="+name+", phase="+phase);
+ return ctx;
+ }
+
+ public Collection<VFSDeployment> getDeployments()
+ {
+ HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
+ deployments.addAll(this.bootstrapCtxs.values());
+ deployments.addAll(this.deployerCtxs.values());
+ deployments.addAll(this.applicationCtxs.values());
+ return Collections.unmodifiableCollection(deployments);
+ }
+
+ /**
+ * Scan the applications for changes.
+ */
+ public synchronized Collection<ModificationInfo> getModifiedDeployments()
+ throws Exception
+ {
+ ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
+ Collection<VFSDeployment> apps = getApplications();
+ boolean trace = log.isTraceEnabled();
+ if( trace )
+ log.trace("Checking applications for modifications");
+ if( trace )
+ log.trace("Aquiring content read lock");
+ contentLock.readLock().lock();
+ try
+ {
+ if( apps != null )
+ {
+ Iterator<VFSDeployment> iter = apps.iterator();
+ int ignoreFlags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
+ while( iter.hasNext() )
+ {
+ VFSDeployment ctx = iter.next();
+ VirtualFile root = ctx.getRoot();
+ String name = root.getPathName();
+ // Ignore locked or disabled applications
+ if(this.hasDeploymentContentFlags(name, DeploymentPhase.APPLICATION, ignoreFlags))
+ {
+ if(trace)
+ log.trace("Ignoring locked application: "+root);
+ continue;
+ }
+ // Check for removal
+ if( root.exists() == false )
+ {
+ long rootLastModified = root.getLastModified();
+ ModificationInfo info = new ModificationInfo(ctx, rootLastModified, ModifyStatus.REMOVED);
+ modified.add(info);
+ iter.remove();
+ if( trace )
+ log.trace(name + " was removed");
+ }
+ // Check for modification
+ else if( hasBeenModified(root) ||
+ hasDeploymentContentFlags(root.getPathName(), DeploymentPhase.APPLICATION, DeploymentContentFlags.MODIFIED) )
+ {
+ long rootLastModified = root.getLastModified();
+ if( trace )
+ log.trace(name + " was modified: " + rootLastModified);
+ // Need to create a duplicate ctx
+ VFSDeployment ctx2 = loadDeploymentData(root, DeploymentPhase.APPLICATION);
+ ModificationInfo info = new ModificationInfo(ctx2, rootLastModified, ModifyStatus.MODIFIED);
+ modified.add(info);
+ }
+ // TODO: this could check metadata files modifications as well
+ }
+ // Now check for additions
+ for (File applicationDir : applicationDirs)
+ {
+ VirtualFile deployDir = getCachedApplicationVF(applicationDir);
+ ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+ addedDeployments(added, deployDir);
+ for(VirtualFile vf : added)
+ {
+ if(this.hasDeploymentContentFlags(vf.getPathName(), DeploymentPhase.APPLICATION, ignoreFlags))
+ {
+ if(trace)
+ log.trace("Ignoring locked application: "+ vf);
+ continue;
+ }
+ VFSDeployment ctx = loadDeploymentData(vf, DeploymentPhase.APPLICATION);
+ ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
+ modified.add(info);
+ applicationCtxs.put(ctx.getName(), ctx);
+ }
+ }
+ }
+ }
+ finally
+ {
+ contentLock.readLock().unlock();
+ if( trace )
+ log.trace("Released content read lock");
+ }
+
+ if(modified.size() > 0)
+ lastModified = System.currentTimeMillis();
+ return modified;
+ }
+
+ /**
+ * Has the root been modified.
+ *
+ * @param root the virtual file root
+ * @return true if modifed
+ * @throws Exception for any error
+ */
+ protected boolean hasBeenModified(VirtualFile root) throws Exception
+ {
+ return root.hasBeenModified();
+ }
+
+ public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
+ throws Exception
+ {
+ Collection<VFSDeployment> ctxs = null;
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ ctxs = this.getBootstraps();
+ break;
+ case DEPLOYER:
+ ctxs = this.getDeployers();
+ break;
+ case APPLICATION:
+ ctxs = this.getApplications();
+ break;
+ }
+ return ctxs;
+ }
+
+ public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
+ throws Exception
+ {
+ VFSDeployment ctx = null;
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ ctx = this.removeBootstrap(name);
+ break;
+ case DEPLOYER:
+ ctx = this.removeDeployer(name);
+ break;
+ case APPLICATION:
+ ctx = this.removeApplication(name);
+ break;
+ }
+ if(ctx != null)
+ lastModified = System.currentTimeMillis();
+ return ctx;
+ }
+
+ public String toString()
+ {
+ StringBuilder tmp = new StringBuilder(super.toString());
+ tmp.append("(root=");
+ tmp.append(root);
+ tmp.append(", key=");
+ tmp.append(key);
+ tmp.append(")");
+ return tmp.toString();
+ }
+
+ /**
+ * Create a profile deployment repository
+ *
+ * @throws IOException
+ */
+ public void create() throws Exception
+ {
+ File profileRoot = new File(root, key.getName());
+ if( profileRoot.exists() == true )
+ throw new IOException("Profile root already exists: "+profileRoot);
+ if( profileRoot.mkdirs() == false )
+ throw new IOException("Failed to create profile root: "+profileRoot);
+ // server/{name}/bootstrap
+ bootstrapDir = new File(profileRoot, "bootstrap");
+ if( bootstrapDir.mkdirs() == false )
+ throw new IOException("Failed to create profile bootstrap dir: "+bootstrapDir);
+
+ // server/{name}/deployers
+ deployersDir = new File(profileRoot, "deployers");
+ if( deployersDir.mkdirs() == false )
+ throw new IOException("Failed to create profile deployers dir: "+deployersDir);
+
+ // server/{name}/deploy
+ for (File applicationDir : applicationDirs)
+ {
+ if( applicationDir.mkdirs() == false )
+ throw new IOException("Failed to create profile deploy dir: "+applicationDir);
+ }
+ // server/{name}/lib
+ libDir = new File(profileRoot, "lib");
+ if( libDir.mkdirs() == false )
+ throw new IOException("Failed to create profile lib dir: "+libDir);
+
+ adminEditsRoot = new File(profileRoot, "attachments");
+ if( adminEditsRoot.mkdirs() == false )
+ throw new IOException("Failed to create profile adminEdits dir: "+adminEditsRoot);
+ }
+
+ /**
+ * Load the profile deployments
+ *
+ * @throws IOException
+ * @throws NoSuchProfileException
+ */
+ public void load() throws Exception, NoSuchProfileException
+ {
+ if( serializer == null )
+ throw new IllegalStateException("serializer has not been set");
+
+ File profileRoot = new File(root, key.getName());
+ if( profileRoot.exists() == false )
+ throw new NoSuchProfileException("Profile root does not exists: "+profileRoot);
+ // server/{name}/bootstrap
+ bootstrapDir = new File(profileRoot, "bootstrap");
+ if( bootstrapDir.exists() == false )
+ {
+ //throw new FileNotFoundException("Profile contains no bootstrap dir: "+bootstrapDir);
+ // fallback to conf/jboss-service.xml for now
+ bootstrapDir = null;
+ }
+
+ // server/{name}/deployers
+ deployersDir = new File(profileRoot, "deployers");
+ if( deployersDir.exists() == false )
+ throw new FileNotFoundException("Profile contains no deployers dir: "+deployersDir);
+
+ // server/{name}/deploy
+ for (File applicationDir : applicationDirs)
+ {
+ if( applicationDir.exists() == false )
+ throw new FileNotFoundException("Profile contains no deploy dir: "+applicationDir);
+ }
+
+ adminEditsRoot = new File(profileRoot, "attachments");
+ if(this.serializer instanceof AbstractFileAttachmentsSerializer)
+ ((AbstractFileAttachmentsSerializer) this.serializer).setAttachmentsStoreDir(adminEditsRoot);
+
+ if( bootstrapDir != null )
+ {
+ VFS bootstrapVFS = VFS.getVFS(bootstrapDir.toURI());
+ loadBootstraps(bootstrapVFS.getRoot());
+ }
+ else
+ {
+ // hack to load conf/jboss-service.xml until its removed
+ loadBootstraps(null);
+ }
+ VFS deployersVFS = VFS.getVFS(deployersDir.toURI());
+ loadDeployers(deployersVFS.getRoot());
+ for (File applicationDir : applicationDirs)
+ {
+ VirtualFile dirVF = getCachedApplicationVF(applicationDir);
+ loadApplications(dirVF);
+ }
+
+ this.lastModified = System.currentTimeMillis();
+ }
+
+ /**
+ * Get virtual file for app dir.
+ *
+ * @param applicationDir the app dir
+ * @return virtual file representing app dir
+ * @throws IOException for any error
+ */
+ protected VirtualFile getCachedApplicationVF(File applicationDir) throws IOException
+ {
+ URI uri = applicationDir.toURI();
+ return getCachedApplicationVF(uri);
+ }
+
+ /**
+ * Get virtual file for app uri.
+ *
+ * @param uri the app uri
+ * @return virtual file representing app uri
+ * @throws IOException for any error
+ */
+ protected VirtualFile getCachedApplicationVF(URI uri) throws IOException
+ {
+ String uriString = uri.toString();
+ VirtualFile dir;
+ synchronized (applicationVFCache)
+ {
+ dir = applicationVFCache.get(uriString);
+ if (dir == null)
+ {
+ dir = VFS.getCachedFile(uri);
+ applicationVFCache.put(uriString, dir);
+ }
+ }
+ return dir;
+ }
+
+ /**
+ * Remove the contents of the profile repository
+ * @throws IOException
+ * @throws NoSuchProfileException
+ */
+ public void remove() throws IOException, NoSuchProfileException
+ {
+ File profileRoot = new File(root, key.getName());
+ Files.delete(profileRoot);
+ }
+
+ protected void addBootstrap(String vfsPath, VFSDeployment ctx)
+ throws Exception
+ {
+ this.bootstrapCtxs.put(vfsPath, ctx);
+ }
+
+ // Managed object attachments for a deployment
+ public void addManagedObject(String vfsPath, Attachments edits)
+ throws IOException
+ {
+ // TODO what should this do ?
+ throw new UnsupportedOperationException("addManagedObject");
+// Map<String, Object> map = edits.getAttachments();
+// File attachments = new File(adminEditsRoot, vfsPath+".edits");
+// ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(attachments));
+// try
+// {
+// oos.writeObject(map);
+// }
+// finally
+// {
+// try
+// {
+// oos.close();
+// }
+// catch (IOException ignore)
+// {
+// }
+// }
+// lastModified = System.currentTimeMillis();
+ }
+
+ protected void addDeployer(String vfsPath, VFSDeployment ctx)
+ throws Exception
+ {
+ this.deployerCtxs.put(vfsPath, ctx);
+ }
+
+ protected void addApplication(String vfsPath, VFSDeployment ctx) throws Exception
+ {
+ log.info("Adding application: " + vfsPath + " / " + ctx);
+ this.applicationCtxs.put(vfsPath, ctx);
+ }
+
+ protected VFSDeployment getBootstrap(String vfsPath) throws Exception
+ {
+ VFSDeployment ctx = bootstrapCtxs.get(vfsPath);
+ if( ctx == null )
+ throw new NoSuchDeploymentException(vfsPath);
+ return ctx;
+ }
+
+ protected Collection<VFSDeployment> getBootstraps() throws Exception
+ {
+ return bootstrapCtxs.values();
+ }
+
+ protected File getPhaseDir(DeploymentPhase phase)
+ {
+ File dir = null;
+ switch( phase )
+ {
+ case BOOTSTRAP:
+ dir = bootstrapDir;
+ break;
+ case DEPLOYER:
+ dir = deployersDir;
+ break;
+ case APPLICATION:
+ dir = applicationDirs[0];
+ break;
+ case APPLICATION_TRANSIENT:
+ // TODO
+ break;
+ }
+ return dir;
+ }
+
+ protected URI getBootstrapURI()
+ {
+ return bootstrapDir.toURI();
+ }
+ protected URI getDeployersURI()
+ {
+ return deployersDir.toURI();
+ }
+ protected URI getApplicationURI()
+ {
+ File applicationDir = applicationDirs[0];
+ return applicationDir.toURI();
+ }
+ protected VFSDeployment getDeployer(String vfsPath)
+ throws Exception
+ {
+ VFSDeployment ctx = deployerCtxs.get(vfsPath);
+ if( ctx == null )
+ throw new NoSuchDeploymentException(vfsPath);
+ return ctx;
+ }
+
+ protected Collection<VFSDeployment> getDeployers()
+ throws Exception
+ {
+ return deployerCtxs.values();
+ }
+
+ protected VFSDeployment getApplication(String vfsPath) throws Exception
+ {
+ boolean trace = log.isTraceEnabled();
+ VFSDeployment ctx = applicationCtxs.get(vfsPath);
+ if( ctx == null )
+ {
+ // Try to find the simple name
+ if(trace)
+ log.trace("Failed to find application for: "+vfsPath+", scanning for simple name");
+ for(VFSDeployment deployment : applicationCtxs.values())
+ {
+ if(trace)
+ log.trace("Checking: "+deployment.getSimpleName());
+ if(deployment.getSimpleName().equals(vfsPath))
+ {
+ if(trace)
+ log.trace("Matched to simple name of deployment:"+deployment);
+ ctx = deployment;
+ break;
+ }
+ }
+ if(ctx == null)
+ {
+ log.debug("Failed to find application for: "+vfsPath+", available: " + applicationCtxs.values());
+ throw new NoSuchDeploymentException(vfsPath);
+ }
+ }
+ return ctx;
+ }
+
+ protected Collection<VFSDeployment> getApplications()
+ throws Exception
+ {
+ return applicationCtxs.values();
+ }
+
+ protected VFSDeployment removeBootstrap(String vfsPath) throws IOException
+ {
+ VFSDeployment vfsDeployment = bootstrapCtxs.get(vfsPath);
+ if(vfsDeployment == null)
+ throw new IllegalStateException("Deployment not found: " + vfsPath + ", available: " + bootstrapCtxs.values());
+ VirtualFile root = vfsDeployment.getRoot();
+ if(root.delete() == false)
+ throw new IOException("Failed to delete: " + root);
+ return bootstrapCtxs.remove(vfsPath);
+ }
+
+ // this is an infinite loop
+ protected VFSDeployment removeDeployer(String vfsPath) throws IOException
+ {
+ VFSDeployment vfsDeployment = deployerCtxs.get(vfsPath);
+ if(vfsDeployment == null)
+ throw new IllegalStateException("Deployment not found: " + vfsPath + ", available: " + deployerCtxs.values());
+ VirtualFile root = vfsDeployment.getRoot();
+ if(root.delete() == false)
+ throw new IOException("Failed to delete: " + root);
+ return deployerCtxs.remove(vfsPath);
+ }
+ protected VFSDeployment removeApplication(String vfsPath) throws Exception
+ {
+ VFSDeployment vfsDeployment = getApplication(vfsPath);
+ VirtualFile root = vfsDeployment.getRoot();
+ if(root.delete() == false)
+ throw new IOException("Failed to delete: " + root);
+ return this.applicationCtxs.remove(vfsPath);
+ }
+ protected void setBootstrapURI(URI uri)
+ {
+ bootstrapDir = new File(uri);
+ }
+ protected void setDeployersURI(URI uri)
+ {
+ deployersDir = new File(uri);
+ }
+
+ /**
+ * Load the bootstrap descriptors under bootstrapDir:
+ *
+ * @param bootstrapDir
+ * @throws IOException
+ */
+ private void loadBootstraps(VirtualFile bootstrapDir)
+ throws IOException
+ {
+ if( bootstrapDir != null )
+ {
+ List<VirtualFile> children = bootstrapDir.getChildren();
+ for(VirtualFile vf : children)
+ {
+ VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.BOOTSTRAP);
+ bootstrapCtxs.put(vfCtx.getName(), vfCtx);
+ }
+ }
+ else
+ {
+ // fallback to conf/jboss-service.xml for now
+ File profileRoot = new File(root, key.getName());
+ File confDir = new File(profileRoot, "conf");
+ VirtualFile confVF = VFS.getRoot(confDir.toURI());
+ VirtualFile jbossServiceVF = confVF.getChild("jboss-service.xml");
+ if(jbossServiceVF == null)
+ throw new FileNotFoundException("Failed to find jboss-service.xml under conf");
+ VFSDeployment vfCtx = loadDeploymentData(jbossServiceVF, DeploymentPhase.BOOTSTRAP);
+ bootstrapCtxs.put(vfCtx.getName(), vfCtx);
+ }
+ }
+
+ /**
+ * Load all the deployments under the deployersDir.
+ *
+ * @param deployersDir
+ * @throws IOException
+ */
+ private void loadDeployers(VirtualFile deployersDir)
+ throws IOException
+ {
+ List<VirtualFile> children = deployersDir.getChildren();
+ for(VirtualFile vf : children)
+ {
+ VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.DEPLOYER);
+ deployerCtxs.put(vfCtx.getName(), vfCtx);
+ }
+ }
+
+ /**
+ * Load all the applications under the applicationDir.
+ *
+ * @param applicationDir
+ * @throws IOException
+ */
+ private void loadApplications(VirtualFile applicationDir)
+ throws Exception
+ {
+ ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+ addedDeployments(added, applicationDir);
+ for (VirtualFile vf : added)
+ {
+ VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.APPLICATION);
+ applicationCtxs.put(vfCtx.getName(), vfCtx);
+ }
+ }
+
+ /**
+ * Added deployments for DeploymentPhase.APPLICATION.
+ *
+ * @param list
+ * @param root
+ * @throws Exception
+ */
+ private void addedDeployments(List<VirtualFile> list, VirtualFile root)
+ throws Exception
+ {
+ List<VirtualFile> components = root.getChildren();
+
+ for (VirtualFile component : components)
+ {
+ String key = component.toURI().toString();
+ if (applicationCtxs.containsKey(key) == true)
+ continue;
+
+ if (component.isLeaf())
+ {
+ list.add(component);
+ }
+ else if (component.getName().indexOf('.') == -1)
+ {
+ // recurse if not '.' in name and recursive search is enabled
+ addedDeployments(list, component);
+ }
+ else
+ {
+ list.add(component);
+ }
+ }
+ }
+
+ /**
+ * TODO Map<String, Object should not be required ?
+ */
+ public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
+ Map<String, Object> attachments) throws Exception
+ {
+ RepositoryAttachmentMetaData metaData = (RepositoryAttachmentMetaData) attachments.get(RepositoryAttachmentMetaData.class.getName());
+ if(metaData != null)
+ {
+ this.updateDeployment(d, phase, metaData);
+ }
+ else
+ {
+ log.error("no metadata attached.");
+ }
+ }
+
+ /**
+ * Update a deployment based on it's RepositoryAttachmentMetaData
+ *
+ * TODO use a xml serializer, to drop the use of the childAttachment maps.
+ *
+ * @param d
+ * @param phase
+ * @param metaData
+ * @throws Exception
+ */
+ public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
+ RepositoryAttachmentMetaData metaData)
+ throws Exception
+ {
+ boolean trace = log.isTraceEnabled();
+
+ // The PhaseDir
+ File path = getPhaseDir(phase);
+ if(path == null)
+ {
+ log.warn("Could not get PhaseDir for DeploymentPhase: " + phase + ", unable to perstisted attachments.");
+ return;
+ }
+
+ // attachments/deploy/deployment/
+ String deploymentPath = path.getName() + File.separator + d.getSimpleName() + File.separator;
+ RepositoryAttachmentMetaData savedMetaData = loadAttachmentMetaData(deploymentPath);
+
+ if(savedMetaData != null)
+ {
+ if(trace)
+ log.trace("Previous metadata found for deployment: " + d);
+ // TODO merge updates
+ }
+
+ // Save attachments for the root context
+ if(metaData.getAttachments() != null && !metaData.getAttachments().isEmpty())
+ {
+ for(AttachmentMetaData attachment : metaData.getAttachments())
+ {
+ String attachmentPath = deploymentPath + attachment.getName();
+ // Serialize the attachment
+ serializer.saveAttachment(attachmentPath, attachment.getAttachment());
+
+ if(trace)
+ log.trace("Stored attachment to : " + attachmentPath);
+ }
+ }
+
+ // Save attachments for the children
+ List<RepositoryAttachmentMetaData> children = metaData.getChildren();
+ if(children != null && !children.isEmpty())
+ {
+ for(RepositoryAttachmentMetaData child : children)
+ {
+ // The relative child path
+ String childPath = deploymentPath + child.getDeploymentName() + File.separator;
+ if(child.getAttachments() != null && ! child.getAttachments().isEmpty())
+ {
+ for(AttachmentMetaData attachment : child.getAttachments())
+ {
+ String attachmentPath = childPath + attachment.getName();
+ // Serialize the attachment
+ serializer.saveAttachment(attachmentPath, attachment.getAttachment());
+
+ if(trace)
+ log.trace("Stored attachment to : " + attachmentPath);
+ }
+ }
+ }
+ }
+
+ // Store the repository metadata
+ this.serializer.saveAttachment(deploymentPath + "metadata", metaData);
+
+ //
+ this.lastModified = System.currentTimeMillis();
+ }
+
+ /**
+ * Load the attachment metadata.
+ *
+ * @param file
+ * @return the deployment
+ */
+ private VFSDeployment loadDeploymentData(VirtualFile file, DeploymentPhase phase)
+ {
+ boolean trace = log.isTraceEnabled();
+ // Create VFS deployment
+ VFSDeployment deployment = factory.createVFSDeployment(file);
+ if(trace)
+ log.trace("Created deployment: " + deployment);
+
+ // The PhaseDir
+ File path = getPhaseDir(phase);
+ if(path == null)
+ {
+ log.debug("Could not get PhaseDir for DeploymentPhase: " + phase + ", do not scann for perstisted attachments.");
+ return deployment;
+ }
+
+
+ // attachments/deploy/deployment/
+ String deploymentPath = path.getName() + File.separator + deployment.getSimpleName() + File.separator;
+ if(trace)
+ log.trace("trying to load attachment from relative path: " + deploymentPath);
+
+ // Load the metadata
+ RepositoryAttachmentMetaData attachmentMetaData = loadAttachmentMetaData(deploymentPath);
+
+ if(attachmentMetaData == null)
+ {
+ if(trace)
+ log.trace("Did not find any presisted metadata for deployment: " + deployment);
+ return deployment;
+ }
+
+ try
+ {
+ // If the deployment has changes we skip this.
+ // TODO delete attachments ?
+ if(attachmentMetaData.getLastModified() < file.getLastModified())
+ {
+ log.debug("Not using the persisted metadata, as the deployment was modified.");
+ return deployment;
+ }
+ }
+ catch(IOException e)
+ {
+ log.error("failed to get LastModified date for file, no using persisted metadata: "+ file.getPathName());
+ return deployment;
+ }
+
+ // Start with "" the root contextPath
+ rebuildStructureContext(deployment, "", deploymentPath, attachmentMetaData, trace);
+
+ return deployment;
+ }
+
+ /**
+ * Rebuild the StructureMetaData based on the RepositoryAttachmentMetaData
+ * and add predeterminedManagedObjects.
+ *
+ * @param deployment the VFSDeployment
+ * @param contextName the structure context path
+ * @param deploymentPath the path to the attachement
+ * @param attachmentMetaData the meta data
+ */
+ protected void rebuildStructureContext(VFSDeployment deployment,
+ String contextName,
+ String deploymentPath,
+ RepositoryAttachmentMetaData attachmentMetaData,
+ boolean trace)
+ {
+ // The toplevel context
+ boolean isRoot = "".equals(contextName);
+
+ if(trace)
+ log.trace("Rebuilding StructureMetaData for context: " + contextName);
+
+
+
+ // Get the stored deployment structure
+ DeploymentStructureMetaData structure = attachmentMetaData.getDeploymentStructure();
+
+ // MetaData and ClassPath
+ List<String> metaDataPaths = new ArrayList<String>();
+ List<ClassPathEntry> classPath = new ArrayList<ClassPathEntry>();
+ if(structure != null)
+ {
+ if(structure.getClassPaths() != null)
+ {
+ for(DeploymentClassPathMetaData md : structure.getClassPaths())
+ classPath.add(factory.createClassPathEntry(md.getPath(), md.getSuffixes()));
+ }
+
+ if(structure.getMetaDataPaths() != null)
+ metaDataPaths = structure.getMetaDataPaths();
+ }
+
+ // Now create the ContextInfo
+ ContextInfo info = factory.addContext(deployment, contextName, metaDataPaths, classPath);
+ if(structure != null)
+ {
+ // Set the comparator
+ info.setComparatorClassName(structure.getComparatorClass());
+ // Set the relative order
+ info.setRelativeOrder(structure.getRelatativeOrder());
+ }
+ if(trace)
+ log.trace("created ContextInfo: "+ info + " for deployment: "+ deployment);
+
+ // Add attachments if needed
+ if(attachmentMetaData.getAttachments() != null && ! attachmentMetaData.getAttachments().isEmpty())
+ {
+ Set<String> availableAttachments = new HashSet<String>();
+ for(AttachmentMetaData attachment : attachmentMetaData.getAttachments())
+ availableAttachments.add(attachment.getName());
+
+ MutableAttachments mutable = new LazyPredeterminedManagedObjects(this.serializer, deploymentPath, availableAttachments);
+
+ // TODO is there a better way to do this ?
+ if(isRoot)
+ deployment.setPredeterminedManagedObjects(mutable);
+ else
+ info.setPredeterminedManagedObjects(mutable);
+
+ if(trace)
+ log.trace("Added PredetminedManagedObjects: " + availableAttachments + " to context " + contextName);
+ }
+ else
+ {
+ if(trace)
+ log.trace("No PredetminedManagedObjects found for context " + contextName);
+ }
+
+ // Process children
+ List<RepositoryAttachmentMetaData> children = attachmentMetaData.getChildren();
+ if(children != null && ! children.isEmpty())
+ {
+ for(RepositoryAttachmentMetaData childMetaData : children)
+ {
+ // The structure context path
+ String childContextName = contextName + "/" + childMetaData.getDeploymentName();
+ // The relative path of the child attachment (therefore File.separator)
+ String relativePath = deploymentPath + childMetaData.getDeploymentName() + File.separator;
+
+ if(trace)
+ log.trace("Processing child context: "+ childContextName);
+
+ // Rebuild the structure of the child
+ rebuildStructureContext(deployment, childContextName, relativePath, childMetaData, trace);
+ }
+ }
+ }
+
+ /**
+ * Load the attachment metadata for a deployment.
+ *
+ * @param relativeDeploymentPath the relatative path to the metadata
+ * @return the attachment metadata
+ */
+ protected RepositoryAttachmentMetaData loadAttachmentMetaData(String relativeDeploymentPath)
+ {
+ final String metaDataName = "metadata";
+ // attachments/deploy/deployment/metadata
+ String fixedMetadataPath = relativeDeploymentPath.endsWith(File.separator) ? relativeDeploymentPath + metaDataName : relativeDeploymentPath + File.separator + metaDataName;
+
+ try
+ {
+ // Try to load metadata Attachment
+ return this.serializer.loadAttachment(fixedMetadataPath, RepositoryAttachmentMetaData.class);
+ }
+ catch(Exception e)
+ {
+ log.error("Failed to load attachment metadata from relative path: "+ relativeDeploymentPath, e);
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/main/org/jboss/system/server/security/SecurityPolicy.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/security/SecurityPolicy.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/main/org/jboss/system/server/security/SecurityPolicy.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,99 +1,99 @@
-/*
-* 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.server.security;
-
-import java.net.URL;
-import java.security.Policy;
-
-import org.jboss.beans.metadata.api.annotations.Start;
-
-/**
- * SecurityPolicy.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class SecurityPolicy
-{
- /** Whether to install the security manager */
- private SecurityManager securityManager;
-
- /** The policy url */
- private URL policyURL;
-
- /**
- * Get the securityManager.
- *
- * @return the securityManager.
- */
- public SecurityManager getSecurityManager()
- {
- return securityManager;
- }
-
- /**
- * Set the securityManager.
- *
- * @param securityManager the securityManager.
- */
- public void setSecurityManager(SecurityManager securityManager)
- {
- this.securityManager = securityManager;
- }
-
- /**
- * Get the policyURL.
- *
- * @return the policyURL.
- */
- public URL getPolicyURL()
- {
- return policyURL;
- }
-
- /**
- * Set the policyURL.
- *
- * @param policyURL the policyURL.
- */
- public void setPolicyURL(URL policyURL)
- {
- this.policyURL = policyURL;
- }
-
- @Start
- public void start()
- {
- if (policyURL != null)
- System.setProperty("java.security.policy", policyURL.toExternalForm());
- Policy.getPolicy().refresh();
-
- if (securityManager != null)
- System.setSecurityManager(securityManager);
- }
-
- public void stop()
- {
- if (securityManager != null)
- System.setSecurityManager(null);
- }
-}
+/*
+* 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.server.security;
+
+import java.net.URL;
+import java.security.Policy;
+
+import org.jboss.beans.metadata.api.annotations.Start;
+
+/**
+ * SecurityPolicy.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SecurityPolicy
+{
+ /** Whether to install the security manager */
+ private SecurityManager securityManager;
+
+ /** The policy url */
+ private URL policyURL;
+
+ /**
+ * Get the securityManager.
+ *
+ * @return the securityManager.
+ */
+ public SecurityManager getSecurityManager()
+ {
+ return securityManager;
+ }
+
+ /**
+ * Set the securityManager.
+ *
+ * @param securityManager the securityManager.
+ */
+ public void setSecurityManager(SecurityManager securityManager)
+ {
+ this.securityManager = securityManager;
+ }
+
+ /**
+ * Get the policyURL.
+ *
+ * @return the policyURL.
+ */
+ public URL getPolicyURL()
+ {
+ return policyURL;
+ }
+
+ /**
+ * Set the policyURL.
+ *
+ * @param policyURL the policyURL.
+ */
+ public void setPolicyURL(URL policyURL)
+ {
+ this.policyURL = policyURL;
+ }
+
+ @Start
+ public void start()
+ {
+ if (policyURL != null)
+ System.setProperty("java.security.policy", policyURL.toExternalForm());
+ Policy.getPolicy().refresh();
+
+ if (securityManager != null)
+ System.setSecurityManager(securityManager);
+ }
+
+ public void stop()
+ {
+ if (securityManager != null)
+ System.setSecurityManager(null);
+ }
+}
Property changes on: trunk/system/src/main/org/jboss/system/server/security/SecurityPolicy.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/resources/dtd/jboss-service_4_2.dtd
===================================================================
--- trunk/system/src/resources/dtd/jboss-service_4_2.dtd 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/resources/dtd/jboss-service_4_2.dtd 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,287 +1,287 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-
-<!-- A skeleton JBoss MBean service descriptor DTD. This cannot be used in
-general to validate a jboss-service.xml descriptor due to the fact that the
-'attribute' element allows ANY content.
-
-$Id: jboss-service_4_0.dtd 33900 2005-07-25 04:26:25Z starksm $
-
-DOCTYPE server
- PUBLIC "-//JBoss//DTD MBean Service 4.2//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-service_4_2.dtd"
--->
-<!-- The server element is the root element.
--->
-<!ELEMENT server (loader-repository? , local-directory* , classpath* , mbean*)>
-
-<!-- The loader-repository specifies the name of the UnifiedLoaderRepository
- MBean to use for the ear to provide ear level scoping of classes deployed
- in the ear. It is a unique JMX ObjectName string. It may also specify
- an arbitrary configuration by including a loader-repository-config element.
-
-Examples:
- <loader-repository>jboss.test:loader=cts-cmp2v1-sar.ear</loader-repository>
-
- <loader-repository loaderRepositoryClass='dot.com.LoaderRepository'>
- dot.com:loader=unique-archive-name
- <loader-repository-config configParserClass='dot.com.LoaderParser'>
- java2ParentDelegaton=true
- </loader-repository-config>
- </loader-repository>
--->
-<!ELEMENT loader-repository (#PCDATA | loader-repository-config)*>
-
-<!-- The loaderRepositoryClass attribute gives the classname of the
-org.jboss.mx.loading.LoaderRepository implementation.
--->
-<!ATTLIST loader-repository loaderRepositoryClass CDATA #IMPLIED>
-
-<!-- The loader-repository-config element specifies any arbitrary configuration
-fragment for use in configuring the loader-repository instance. The actual
-content of this element is specific to the loaderRepositoryClass and the
-code parsing the element.
--->
-<!ELEMENT loader-repository-config (#PCDATA)>
-
-<!-- The configParserClass attribute gives the classname of the
-org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfigParser
-implementation to use to parse the loader-repository-config content.
--->
-<!ATTLIST loader-repository-config configParserClass CDATA #IMPLIED>
-
-<!-- A local-directory element specifies that portions of the sar are to be unjard into the data
-directory of the server configuration.
--->
-<!ELEMENT local-directory EMPTY>
-
-<!-- The optional path attribute gives the prefix of the sar entries that should be copied
-into the data directory. If it is not specified the entire sar contents will be placed into
-the data directory.
--->
-<!ATTLIST local-directory path CDATA #IMPLIED>
-
-<!-- A classpath element specifies a location which will be included in the services
-deployment classpath.
--->
-<!ELEMENT classpath EMPTY>
-
-<!-- The codebase attribute specifies the base URL from which the jars or classes
-are loaded from. If the codebase is '.' then it is equal to the mbean deployment URL.
-Otherwise, it is resolved as a path spec relative to the serverHomeURL (e.g., file:/jboss-3.2.0)
-using the URL ctor URL(serverHomeURL, codebase)
-
-Examples:
-
- <classpath codebase='.' archives='util.jar' />
- <classpath codebase='http://classloader.dot.com' archives='*' />
- <classpath codebase="lib" archives="*"/>
--->
-<!ATTLIST classpath codebase CDATA #REQUIRED>
-
-<!-- The archives attribute specifies either the '*' wildcard to indicate all contents of the
-codebase should be included, or a comma seperated list of the jars to include.
--->
-<!ATTLIST classpath archives CDATA #IMPLIED>
-
-<!-- The mbean element defines a JBoss MBean service. This includes the
-mbean class, attributes and dependencies.
--->
-<!ELEMENT mbean (constructor? , xmbean? , attribute* , depends* , depends-list*)>
-
-<!-- The code attributes gives the fully qualified name of the MBean
-implementation class.
--->
-<!ATTLIST mbean code CDATA #REQUIRED>
-
-<!-- The name attribute gives the JMX ObjectName string to use when registering
-the MBean. This must be a unique and valid JMX name.
--->
-<!ATTLIST mbean name CDATA #REQUIRED>
-
-<!-- The optional interface attribute gives the full qualified name of the class
-uses to construct the management interface of the mbean. In absence of it an interface
-with the name ending by MBean will be looked in the implementation class. When used
-this interface is defined explicitely.
--->
-<!ATTLIST mbean interface CDATA #IMPLIED>
-
-<!-- The xmbean-dd attribute defines the path to the JBoss XMBean descriptor. This
-is an xml document conforming to:
-
-<!DOCTYPE mbean PUBLIC
- "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
-
-If the descriptor is embedded via a nested xmbean element, the xmbean-dd attribute
-must be given as an empty string.
-
-Example:
- <mbean code="org.jboss.test.jmx.xmbean.User"
- name="jboss.test:service=xmbean-user"
- xmbean-dd="META-INF/org/jboss/test/jmx/xmbean/User.xml" />
--->
-<!ATTLIST mbean xmbean-dd CDATA #IMPLIED>
-
-<!-- The optional xmbean-code attribute specifies the ModelMBean implementation class
-to use. This defaults to org.jboss.mx.modelmbean.XMBean.
--->
-<!ATTLIST mbean xmbean-code CDATA #IMPLIED>
-
-<!-- The xmbean element specifies a nested JBoss XMBean descriptor fragment. Its
-supported content model is the same as the mbean element of the jboss_xmbean_1_0.dtd
-
-Example:
- <mbean code="org.jboss.test.jmx.xmbean.User"
- name="jboss.test:service=xmbean-user"
- xmbean-dd="">
- <xmbean>
- ...
- </xmbean>
- </mbean>
--->
-<!ELEMENT xmbean ANY>
-
-<!-- The constructor element defines a non-default constructor to use when
-instantiating the mbean.
--->
-<!ELEMENT constructor (arg*)>
-
-<!-- The arg element specify the constructor arguments in the order of the
-ctor signature. Each arg has a type and value attribute.
--->
-<!ELEMENT arg EMPTY>
-
-<!-- The type attribute gives the type of the argument as defined in the
-ctor signature. If not defined java.lang.String is assumed.
--->
-<!ATTLIST arg type CDATA #IMPLIED>
-
-<!-- The value attribute provides the string representation of the ctor
-argument. It is converted from a string to type using Java PropertyEditor or a
-ctor taking a single string as its argument.
--->
-<!ATTLIST arg value CDATA #REQUIRED>
-
-<!-- The attribute element specifies the initial value for a management attribute of
-the enclosing mbean. Typically the value of the attribute element is the string
-representation of the attribute, but it can be an arbitrary xml fragment that is
-parsed by the mbean.
--->
-<!ELEMENT attribute ANY>
-
-<!-- The required name attribute gives the name of the attribute. This is the
-name exposed by the mbean to the MBeanServer for the attribute.
--->
-<!ATTLIST attribute name CDATA #REQUIRED>
-
-<!-- The optional replace attribute indicates whether references of the form ${x}
-in the attribute element content should be replaced with the corresponding
-System.getProperty(x) value.
--->
-<!ATTLIST attribute replace (true | false) 'true'>
-<!-- The optional trim attribute specifies whether the attribute element content should
-be trimmed of whitespace.
--->
-<!ATTLIST attribute trim (true | false) 'true'>
-
-<!-- The attributeClass attribute specifies that type of object that
-should be created. This is needed for non-concreate attribute types
-like interfaces and abstract classes.
--->
-<!ATTLIST attribute attributeClass CDATA #IMPLIED>
-
-<!-- The serialDataType defines the how the content of the attribute
-element is interpretted by the ServiceConfigurator. The possible values
-are:
- + text: the content is treated as the string representation of the
- attribute value. It will be mapped to the attribute using the PropertyEditor
- registered for the attribute type.
- + javaBean: the content is a collection of property elements.
- + jbxb: the content is an xml element from a namespace with an associated
- xml schema that can be unmarshalled using the JBossXB framework.
--->
-<!ATTLIST attribute serialDataType (text | javaBean | jbxb) 'text'>
-
-<!-- The property element is used to describe the JavaBean properties of
-an attribute when the attribute element serialDataType is javaBean.
--->
-<!ELEMENT property (#PCDATA)>
-<!-- The required name attribute gives the name of the property. This is the
-name of a JavaBean property for the attribute type.
--->
-<!ATTLIST property name CDATA #REQUIRED>
-
-<!-- The depends element specifies a JMX ObjectName string for an mbean
-on which the enclosing mbean depends.
-
-Example:
- <mbean code="myBean" name="domain:name=x">
- <depends optional-attribute-name="yName">domain:name=y</depends>
- </mbean>
-
- <mbean code="myBean" name="domain:name=x">
- <depends optional-attribute-name="anonName">
- <mbean code="nestedBean" name="domain:name=x.y">
- ...
- </mbean>
- </depends>
- </mbean>
--->
-<!ELEMENT depends (#PCDATA | mbean)*>
-
-<!-- The optional-attribute-name attribute specifies the attribute name
-which should be populated with the JMX ObjectName of the depends element.
-This allows an mbean to have access to the name of the mbean on which
-it depends.
--->
-<!ATTLIST depends optional-attribute-name CDATA #IMPLIED>
-
-<!-- The proxy-type attribute specifies the interface name
-that should be exposed on an MBeanProxy pointing at the dependent
-MBean, specified by the JMX ObjectName.
-
-The special value proxy-type="attribute" will use the
-class declared in the MBeanAttributeInfo as the interface
-for the MBeanProxy.
-
-Example:
- <mbean code="org.jboss.example.Helper" name="domain:name=helper"/>
-
- <mbean code="myBean" name="domain:name=x">
- <depends optional-attribute-name="Helper"
- proxy-type="org.jboss.example.HelperMBean"
- >domain:name=helper</depends>
- </mbean>
-
- <mbean code="myBean" name="domain:name=x">
- <depends optional-attribute-name="Helper"
- proxy-type="attribute"
- >domain:name=helper</depends>
- </mbean>
--->
-<!ATTLIST depends proxy-type CDATA #IMPLIED>
-
-<!-- The depends-list element specifies a series of JMX ObjectName
-strings of mbeans on which the enclosing mbean depends.
-
-Example:
- <mbean code="myBean" name="domain:name=x">
- <depends-list optional-attribute-name="myObjectNameList">
- <depends-list-element>domain:name=y</depends-list-element>
- <depends-list-element>domain:name=z</depends-list-element>
- </depends-list>
- </mbean>
--->
-<!ELEMENT depends-list (depends-list-element)+>
-
-<!-- The optional-attribute-name attribute specifies the attribute name
-which should be populated with a java.util.List that contains the JMX
-ObjectName(s) of the depends-list elements. This allows an mbean to have
-access to the names of the mbeans on which it depends.
--->
-<!ATTLIST depends-list optional-attribute-name CDATA #IMPLIED>
-
-<!-- The depends-list-element element specifies a JMX ObjectName string
-for an mbean on which the enclosing mbean depends.
--->
-<!ELEMENT depends-list-element (#PCDATA | mbean)*>
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!-- A skeleton JBoss MBean service descriptor DTD. This cannot be used in
+general to validate a jboss-service.xml descriptor due to the fact that the
+'attribute' element allows ANY content.
+
+$Id: jboss-service_4_0.dtd 33900 2005-07-25 04:26:25Z starksm $
+
+DOCTYPE server
+ PUBLIC "-//JBoss//DTD MBean Service 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-service_4_2.dtd"
+-->
+<!-- The server element is the root element.
+-->
+<!ELEMENT server (loader-repository? , local-directory* , classpath* , mbean*)>
+
+<!-- The loader-repository specifies the name of the UnifiedLoaderRepository
+ MBean to use for the ear to provide ear level scoping of classes deployed
+ in the ear. It is a unique JMX ObjectName string. It may also specify
+ an arbitrary configuration by including a loader-repository-config element.
+
+Examples:
+ <loader-repository>jboss.test:loader=cts-cmp2v1-sar.ear</loader-repository>
+
+ <loader-repository loaderRepositoryClass='dot.com.LoaderRepository'>
+ dot.com:loader=unique-archive-name
+ <loader-repository-config configParserClass='dot.com.LoaderParser'>
+ java2ParentDelegaton=true
+ </loader-repository-config>
+ </loader-repository>
+-->
+<!ELEMENT loader-repository (#PCDATA | loader-repository-config)*>
+
+<!-- The loaderRepositoryClass attribute gives the classname of the
+org.jboss.mx.loading.LoaderRepository implementation.
+-->
+<!ATTLIST loader-repository loaderRepositoryClass CDATA #IMPLIED>
+
+<!-- The loader-repository-config element specifies any arbitrary configuration
+fragment for use in configuring the loader-repository instance. The actual
+content of this element is specific to the loaderRepositoryClass and the
+code parsing the element.
+-->
+<!ELEMENT loader-repository-config (#PCDATA)>
+
+<!-- The configParserClass attribute gives the classname of the
+org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfigParser
+implementation to use to parse the loader-repository-config content.
+-->
+<!ATTLIST loader-repository-config configParserClass CDATA #IMPLIED>
+
+<!-- A local-directory element specifies that portions of the sar are to be unjard into the data
+directory of the server configuration.
+-->
+<!ELEMENT local-directory EMPTY>
+
+<!-- The optional path attribute gives the prefix of the sar entries that should be copied
+into the data directory. If it is not specified the entire sar contents will be placed into
+the data directory.
+-->
+<!ATTLIST local-directory path CDATA #IMPLIED>
+
+<!-- A classpath element specifies a location which will be included in the services
+deployment classpath.
+-->
+<!ELEMENT classpath EMPTY>
+
+<!-- The codebase attribute specifies the base URL from which the jars or classes
+are loaded from. If the codebase is '.' then it is equal to the mbean deployment URL.
+Otherwise, it is resolved as a path spec relative to the serverHomeURL (e.g., file:/jboss-3.2.0)
+using the URL ctor URL(serverHomeURL, codebase)
+
+Examples:
+
+ <classpath codebase='.' archives='util.jar' />
+ <classpath codebase='http://classloader.dot.com' archives='*' />
+ <classpath codebase="lib" archives="*"/>
+-->
+<!ATTLIST classpath codebase CDATA #REQUIRED>
+
+<!-- The archives attribute specifies either the '*' wildcard to indicate all contents of the
+codebase should be included, or a comma seperated list of the jars to include.
+-->
+<!ATTLIST classpath archives CDATA #IMPLIED>
+
+<!-- The mbean element defines a JBoss MBean service. This includes the
+mbean class, attributes and dependencies.
+-->
+<!ELEMENT mbean (constructor? , xmbean? , attribute* , depends* , depends-list*)>
+
+<!-- The code attributes gives the fully qualified name of the MBean
+implementation class.
+-->
+<!ATTLIST mbean code CDATA #REQUIRED>
+
+<!-- The name attribute gives the JMX ObjectName string to use when registering
+the MBean. This must be a unique and valid JMX name.
+-->
+<!ATTLIST mbean name CDATA #REQUIRED>
+
+<!-- The optional interface attribute gives the full qualified name of the class
+uses to construct the management interface of the mbean. In absence of it an interface
+with the name ending by MBean will be looked in the implementation class. When used
+this interface is defined explicitely.
+-->
+<!ATTLIST mbean interface CDATA #IMPLIED>
+
+<!-- The xmbean-dd attribute defines the path to the JBoss XMBean descriptor. This
+is an xml document conforming to:
+
+<!DOCTYPE mbean PUBLIC
+ "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
+
+If the descriptor is embedded via a nested xmbean element, the xmbean-dd attribute
+must be given as an empty string.
+
+Example:
+ <mbean code="org.jboss.test.jmx.xmbean.User"
+ name="jboss.test:service=xmbean-user"
+ xmbean-dd="META-INF/org/jboss/test/jmx/xmbean/User.xml" />
+-->
+<!ATTLIST mbean xmbean-dd CDATA #IMPLIED>
+
+<!-- The optional xmbean-code attribute specifies the ModelMBean implementation class
+to use. This defaults to org.jboss.mx.modelmbean.XMBean.
+-->
+<!ATTLIST mbean xmbean-code CDATA #IMPLIED>
+
+<!-- The xmbean element specifies a nested JBoss XMBean descriptor fragment. Its
+supported content model is the same as the mbean element of the jboss_xmbean_1_0.dtd
+
+Example:
+ <mbean code="org.jboss.test.jmx.xmbean.User"
+ name="jboss.test:service=xmbean-user"
+ xmbean-dd="">
+ <xmbean>
+ ...
+ </xmbean>
+ </mbean>
+-->
+<!ELEMENT xmbean ANY>
+
+<!-- The constructor element defines a non-default constructor to use when
+instantiating the mbean.
+-->
+<!ELEMENT constructor (arg*)>
+
+<!-- The arg element specify the constructor arguments in the order of the
+ctor signature. Each arg has a type and value attribute.
+-->
+<!ELEMENT arg EMPTY>
+
+<!-- The type attribute gives the type of the argument as defined in the
+ctor signature. If not defined java.lang.String is assumed.
+-->
+<!ATTLIST arg type CDATA #IMPLIED>
+
+<!-- The value attribute provides the string representation of the ctor
+argument. It is converted from a string to type using Java PropertyEditor or a
+ctor taking a single string as its argument.
+-->
+<!ATTLIST arg value CDATA #REQUIRED>
+
+<!-- The attribute element specifies the initial value for a management attribute of
+the enclosing mbean. Typically the value of the attribute element is the string
+representation of the attribute, but it can be an arbitrary xml fragment that is
+parsed by the mbean.
+-->
+<!ELEMENT attribute ANY>
+
+<!-- The required name attribute gives the name of the attribute. This is the
+name exposed by the mbean to the MBeanServer for the attribute.
+-->
+<!ATTLIST attribute name CDATA #REQUIRED>
+
+<!-- The optional replace attribute indicates whether references of the form ${x}
+in the attribute element content should be replaced with the corresponding
+System.getProperty(x) value.
+-->
+<!ATTLIST attribute replace (true | false) 'true'>
+<!-- The optional trim attribute specifies whether the attribute element content should
+be trimmed of whitespace.
+-->
+<!ATTLIST attribute trim (true | false) 'true'>
+
+<!-- The attributeClass attribute specifies that type of object that
+should be created. This is needed for non-concreate attribute types
+like interfaces and abstract classes.
+-->
+<!ATTLIST attribute attributeClass CDATA #IMPLIED>
+
+<!-- The serialDataType defines the how the content of the attribute
+element is interpretted by the ServiceConfigurator. The possible values
+are:
+ + text: the content is treated as the string representation of the
+ attribute value. It will be mapped to the attribute using the PropertyEditor
+ registered for the attribute type.
+ + javaBean: the content is a collection of property elements.
+ + jbxb: the content is an xml element from a namespace with an associated
+ xml schema that can be unmarshalled using the JBossXB framework.
+-->
+<!ATTLIST attribute serialDataType (text | javaBean | jbxb) 'text'>
+
+<!-- The property element is used to describe the JavaBean properties of
+an attribute when the attribute element serialDataType is javaBean.
+-->
+<!ELEMENT property (#PCDATA)>
+<!-- The required name attribute gives the name of the property. This is the
+name of a JavaBean property for the attribute type.
+-->
+<!ATTLIST property name CDATA #REQUIRED>
+
+<!-- The depends element specifies a JMX ObjectName string for an mbean
+on which the enclosing mbean depends.
+
+Example:
+ <mbean code="myBean" name="domain:name=x">
+ <depends optional-attribute-name="yName">domain:name=y</depends>
+ </mbean>
+
+ <mbean code="myBean" name="domain:name=x">
+ <depends optional-attribute-name="anonName">
+ <mbean code="nestedBean" name="domain:name=x.y">
+ ...
+ </mbean>
+ </depends>
+ </mbean>
+-->
+<!ELEMENT depends (#PCDATA | mbean)*>
+
+<!-- The optional-attribute-name attribute specifies the attribute name
+which should be populated with the JMX ObjectName of the depends element.
+This allows an mbean to have access to the name of the mbean on which
+it depends.
+-->
+<!ATTLIST depends optional-attribute-name CDATA #IMPLIED>
+
+<!-- The proxy-type attribute specifies the interface name
+that should be exposed on an MBeanProxy pointing at the dependent
+MBean, specified by the JMX ObjectName.
+
+The special value proxy-type="attribute" will use the
+class declared in the MBeanAttributeInfo as the interface
+for the MBeanProxy.
+
+Example:
+ <mbean code="org.jboss.example.Helper" name="domain:name=helper"/>
+
+ <mbean code="myBean" name="domain:name=x">
+ <depends optional-attribute-name="Helper"
+ proxy-type="org.jboss.example.HelperMBean"
+ >domain:name=helper</depends>
+ </mbean>
+
+ <mbean code="myBean" name="domain:name=x">
+ <depends optional-attribute-name="Helper"
+ proxy-type="attribute"
+ >domain:name=helper</depends>
+ </mbean>
+-->
+<!ATTLIST depends proxy-type CDATA #IMPLIED>
+
+<!-- The depends-list element specifies a series of JMX ObjectName
+strings of mbeans on which the enclosing mbean depends.
+
+Example:
+ <mbean code="myBean" name="domain:name=x">
+ <depends-list optional-attribute-name="myObjectNameList">
+ <depends-list-element>domain:name=y</depends-list-element>
+ <depends-list-element>domain:name=z</depends-list-element>
+ </depends-list>
+ </mbean>
+-->
+<!ELEMENT depends-list (depends-list-element)+>
+
+<!-- The optional-attribute-name attribute specifies the attribute name
+which should be populated with a java.util.List that contains the JMX
+ObjectName(s) of the depends-list elements. This allows an mbean to have
+access to the names of the mbeans on which it depends.
+-->
+<!ATTLIST depends-list optional-attribute-name CDATA #IMPLIED>
+
+<!-- The depends-list-element element specifies a JMX ObjectName string
+for an mbean on which the enclosing mbean depends.
+-->
+<!ELEMENT depends-list-element (#PCDATA | mbean)*>
Property changes on: trunk/system/src/resources/dtd/jboss-service_4_2.dtd
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: trunk/system/src/resources/dtd/jboss-service_5_0.dtd
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,147 +1,147 @@
-/*
- * 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.server.profileservice;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-
-import org.jboss.Main;
-import org.jboss.bootstrap.microcontainer.ServerImpl;
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.test.BaseTestCase;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Test of the jboss main loading a configuration via the ProfileService.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class MainTestCase extends BaseTestCase
-{
- public MainTestCase(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void testCreateDefaultProfile() throws Throwable
- {
- // Set the jboss.server.home.url property to the system/src/resources dir
- URL bootstrapDir = super.getResource("/bootstrap");
- log.info("bootstrapDir: "+bootstrapDir);
- URL resourcesDir = new URL(bootstrapDir, "..");
- log.info("resourcesDir: "+resourcesDir);
- System.setProperty("jboss.server.home.url", resourcesDir.toString());
- System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
- URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
- System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
-
- //
- ServerImpl server = new ServerImpl();
- server.init(System.getProperties());
- server.start();
- try
- {
- Kernel kernel = server.getKernel();
- ProfileService ps = getBean(kernel, "ProfileService", ProfileService.class);
- ProfileKey defaultKey = new ProfileKey("default");
- Profile profile = ps.getProfile(defaultKey);
- VFSDeployment testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
- if( testBeans == null )
- {
- if( profile == null )
- profile = ps.newProfile(defaultKey);
- MainDeployer deployer = getBean(kernel, "MainDeployer", MainDeployer.class);
- VFS vfs = VFS.getVFS(resourcesDir);
- VirtualFile file = vfs.findChild("deploy/beans/test-beans.xml");
- testBeans = createDeployment(file);
- deployer.addDeployment(testBeans);
- profile.addDeployment(testBeans, DeploymentPhase.APPLICATION);
- }
- // Validate the deployment
- testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
- assertNotNull(testBeans);
- // TODO String type = testBeans.getType();
- // assertEquals("Deployment type is beans", "beans", type);
- }
- finally
- {
- server.shutdown();
- }
- }
-
- /**
- * Test the startup of the org.jboss.Main entry point using the "default"
- * profile.
- * @throws Exception
- */
- public void testDefaultStartup() throws Exception
- {
- // Set the jboss.server.home.url property to the system/src/resources dir
- URL bootstrapDir = super.getResource("/bootstrap");
- log.info("bootstrapDir: "+bootstrapDir);
- URL resourcesDir = new URL(bootstrapDir, "..");
- log.info("resourcesDir: "+resourcesDir);
- System.setProperty("jboss.server.home.url", resourcesDir.toString());
- // Set the jbosstest.support.dir to output/tests-support
- File supportDir = new File("output/tests-support");
- System.setProperty("jbosstest.support.dir", supportDir.toString());
- System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
- URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
- System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
-
- ArrayList<String> args = new ArrayList<String>();
- String[] tmp = {};
- Main main = new Main();
- main.boot(args.toArray(tmp));
- main.shutdown();
- }
-
- protected <T> T getBean(Kernel kernel, String name, Class<T> expectedType)
- {
- KernelController controller = kernel.getController();
- ControllerContext context = controller.getInstalledContext(name);
- if (context == null)
- fail("Context not installed " + name);
- Object result = context.getTarget();
- return expectedType.cast(result);
- }
-
- protected VFSDeployment createDeployment(VirtualFile file)
- {
- return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
- }
-}
+/*
+ * 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.server.profileservice;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.jboss.Main;
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.test.BaseTestCase;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Test of the jboss main loading a configuration via the ProfileService.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class MainTestCase extends BaseTestCase
+{
+ public MainTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Public --------------------------------------------------------
+
+ public void testCreateDefaultProfile() throws Throwable
+ {
+ // Set the jboss.server.home.url property to the system/src/resources dir
+ URL bootstrapDir = super.getResource("/bootstrap");
+ log.info("bootstrapDir: "+bootstrapDir);
+ URL resourcesDir = new URL(bootstrapDir, "..");
+ log.info("resourcesDir: "+resourcesDir);
+ System.setProperty("jboss.server.home.url", resourcesDir.toString());
+ System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
+ URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
+ System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
+
+ //
+ ServerImpl server = new ServerImpl();
+ server.init(System.getProperties());
+ server.start();
+ try
+ {
+ Kernel kernel = server.getKernel();
+ ProfileService ps = getBean(kernel, "ProfileService", ProfileService.class);
+ ProfileKey defaultKey = new ProfileKey("default");
+ Profile profile = ps.getProfile(defaultKey);
+ VFSDeployment testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
+ if( testBeans == null )
+ {
+ if( profile == null )
+ profile = ps.newProfile(defaultKey);
+ MainDeployer deployer = getBean(kernel, "MainDeployer", MainDeployer.class);
+ VFS vfs = VFS.getVFS(resourcesDir);
+ VirtualFile file = vfs.findChild("deploy/beans/test-beans.xml");
+ testBeans = createDeployment(file);
+ deployer.addDeployment(testBeans);
+ profile.addDeployment(testBeans, DeploymentPhase.APPLICATION);
+ }
+ // Validate the deployment
+ testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
+ assertNotNull(testBeans);
+ // TODO String type = testBeans.getType();
+ // assertEquals("Deployment type is beans", "beans", type);
+ }
+ finally
+ {
+ server.shutdown();
+ }
+ }
+
+ /**
+ * Test the startup of the org.jboss.Main entry point using the "default"
+ * profile.
+ * @throws Exception
+ */
+ public void testDefaultStartup() throws Exception
+ {
+ // Set the jboss.server.home.url property to the system/src/resources dir
+ URL bootstrapDir = super.getResource("/bootstrap");
+ log.info("bootstrapDir: "+bootstrapDir);
+ URL resourcesDir = new URL(bootstrapDir, "..");
+ log.info("resourcesDir: "+resourcesDir);
+ System.setProperty("jboss.server.home.url", resourcesDir.toString());
+ // Set the jbosstest.support.dir to output/tests-support
+ File supportDir = new File("output/tests-support");
+ System.setProperty("jbosstest.support.dir", supportDir.toString());
+ System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
+ URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
+ System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
+
+ ArrayList<String> args = new ArrayList<String>();
+ String[] tmp = {};
+ Main main = new Main();
+ main.boot(args.toArray(tmp));
+ main.shutdown();
+ }
+
+ protected <T> T getBean(Kernel kernel, String name, Class<T> expectedType)
+ {
+ KernelController controller = kernel.getController();
+ ControllerContext context = controller.getInstalledContext(name);
+ if (context == null)
+ fail("Context not installed " + name);
+ Object result = context.getTarget();
+ return expectedType.cast(result);
+ }
+
+ protected VFSDeployment createDeployment(VirtualFile file)
+ {
+ return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ }
+}
Property changes on: trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java 2008-11-14 15:15:40 UTC (rev 81069)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java 2008-11-14 15:17:21 UTC (rev 81070)
@@ -1,147 +1,147 @@
-/*
- * 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.server.profileservice;
-
-import java.io.File;
-import java.security.CodeSource;
-
-import org.jboss.Main;
-import org.jboss.bootstrap.microcontainer.ServerImpl;
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.test.BaseTestCase;
-
-/**
- * Test of the jboss main loading a bootstrap configuration via the ProfileService
- * and additional service via a simple hot deployment service.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision: 56797 $
- */
-public class MainWithSimpleHotDeployTestCase extends BaseTestCase
-{
- public MainWithSimpleHotDeployTestCase(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.jboss.test.AbstractTestCase#configureLogging()
- */
- @Override
- protected void configureLogging()
- {
- //enableTrace("org.jboss.kernel");
- }
-
- /**
- * Test the startup of the org.jboss.Main entry point using the "default"
- * profile and bootstrap deployer-beans.xml search logic.
- * @throws Exception
- */
- public void testDefaultStartup() throws Exception
- {
- String deployPrefix = "";
- // If jbosstest.deploy.dir is not defined fail
- String deployDirEnv = System.getenv("jbosstest.deploy.dir");
- String deployDirProp = System.getProperty("jbosstest.deploy.dir");
- if( deployDirProp == null && deployDirEnv != null )
- {
- System.setProperty("jbosstest.deploy.dir", deployDirEnv);
- deployDirProp = deployDirEnv;
- }
- String supportDirEnv = System.getenv("jbosstest.support.dir");
- String supportDirProp = System.getProperty("jbosstest.support.dir");
- if( supportDirProp == null && supportDirEnv != null )
- {
- System.setProperty("jbosstest.support.dir", supportDirEnv);
- supportDirProp = supportDirEnv;
- }
-
- if( supportDirProp == null )
- {
- // If these have not been set, assume running inside eclipse from the system folder
- File resourcesDir = new File("output/eclipse-resources");
- File classesDir = new File("output/eclipse-test-classes");
- deployDirProp = resourcesDir.toURL().toExternalForm();
- supportDirProp = classesDir.toURL().toExternalForm();
- System.setProperty("jbosstest.deploy.dir", deployDirProp);
- System.setProperty("jbosstest.support.dir", supportDirProp);
- deployPrefix = "tests/bootstrap/defaulthotdeploy/";
- }
- assertNotNull("jbosstest.support.dir != null", supportDirProp);
- assertNotNull("jbosstest.deploy.dir != null", deployDirProp);
- // Set the deploy prefix
-
-
- String[] args = {"-c", "defaulthotdeploy", "-Djboss.server.deployerBeansPrefix="+deployPrefix};
- Main main = new Main();
- main.boot(args);
- Server server = main.getServer();
- assertTrue("Server", server instanceof ServerImpl);
- ServerImpl serverImpl = (ServerImpl) server;
-
- // Validate that the expected deployment beans exist
- Kernel kernel = serverImpl.getKernel();
- assertInstalled(kernel, "ProfileService");
- assertInstalled(kernel, "MainDeployer");
- assertInstalled(kernel, "BeanDeployer");
- assertInstalled(kernel, "VFSDeploymentScanner");
- KernelRegistry registry = kernel.getRegistry();
- KernelRegistryEntry entry = registry.getEntry("VFSDeploymentScanner");
- /** TODO DeploymentScanner scanner = (DeploymentScanner) entry.getTarget();
- synchronized( scanner )
- {
- while( scanner.getScanCount() <= 0 )
- scanner.wait(10000);
- }
- log.info("Notified of scan: "+scanner.getScanCount());
- */
-
- // Expected hot deployments
- assertInstalled(kernel, "VFSClassLoader");
- assertInstalled(kernel, "TestBean");
- assertInstalled(kernel, "VFSClassLoader-unpacked");
- assertInstalled(kernel, "TestBean-unpacked");
- entry = registry.getEntry("TestBean");
- Object testBean = entry.getTarget();
- CodeSource testBeanCS = testBean.getClass().getProtectionDomain().getCodeSource();
- log.info("TestBean.CS: "+testBeanCS);
- log.info("TestBean.ClassLoader: "+testBean.getClass().getClassLoader());
-
-
- // Shutdown
- main.shutdown();
- }
-
- private void assertInstalled(Kernel kernel, String name)
- {
- KernelRegistry registry = kernel.getRegistry();
- KernelRegistryEntry entry = registry.getEntry(name);
- assertEquals(name+" Installed", ControllerState.INSTALLED, entry.getState());
- }
-}
+/*
+ * 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.server.profileservice;
+
+import java.io.File;
+import java.security.CodeSource;
+
+import org.jboss.Main;
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.bootstrap.spi.Server;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Test of the jboss main loading a bootstrap configuration via the ProfileService
+ * and additional service via a simple hot deployment service.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 56797 $
+ */
+public class MainWithSimpleHotDeployTestCase extends BaseTestCase
+{
+ public MainWithSimpleHotDeployTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Public --------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.jboss.test.AbstractTestCase#configureLogging()
+ */
+ @Override
+ protected void configureLogging()
+ {
+ //enableTrace("org.jboss.kernel");
+ }
+
+ /**
+ * Test the startup of the org.jboss.Main entry point using the "default"
+ * profile and bootstrap deployer-beans.xml search logic.
+ * @throws Exception
+ */
+ public void testDefaultStartup() throws Exception
+ {
+ String deployPrefix = "";
+ // If jbosstest.deploy.dir is not defined fail
+ String deployDirEnv = System.getenv("jbosstest.deploy.dir");
+ String deployDirProp = System.getProperty("jbosstest.deploy.dir");
+ if( deployDirProp == null && deployDirEnv != null )
+ {
+ System.setProperty("jbosstest.deploy.dir", deployDirEnv);
+ deployDirProp = deployDirEnv;
+ }
+ String supportDirEnv = System.getenv("jbosstest.support.dir");
+ String supportDirProp = System.getProperty("jbosstest.support.dir");
+ if( supportDirProp == null && supportDirEnv != null )
+ {
+ System.setProperty("jbosstest.support.dir", supportDirEnv);
+ supportDirProp = supportDirEnv;
+ }
+
+ if( supportDirProp == null )
+ {
+ // If these have not been set, assume running inside eclipse from the system folder
+ File resourcesDir = new File("output/eclipse-resources");
+ File classesDir = new File("output/eclipse-test-classes");
+ deployDirProp = resourcesDir.toURL().toExternalForm();
+ supportDirProp = classesDir.toURL().toExternalForm();
+ System.setProperty("jbosstest.deploy.dir", deployDirProp);
+ System.setProperty("jbosstest.support.dir", supportDirProp);
+ deployPrefix = "tests/bootstrap/defaulthotdeploy/";
+ }
+ assertNotNull("jbosstest.support.dir != null", supportDirProp);
+ assertNotNull("jbosstest.deploy.dir != null", deployDirProp);
+ // Set the deploy prefix
+
+
+ String[] args = {"-c", "defaulthotdeploy", "-Djboss.server.deployerBeansPrefix="+deployPrefix};
+ Main main = new Main();
+ main.boot(args);
+ Server server = main.getServer();
+ assertTrue("Server", server instanceof ServerImpl);
+ ServerImpl serverImpl = (ServerImpl) server;
+
+ // Validate that the expected deployment beans exist
+ Kernel kernel = serverImpl.getKernel();
+ assertInstalled(kernel, "ProfileService");
+ assertInstalled(kernel, "MainDeployer");
+ assertInstalled(kernel, "BeanDeployer");
+ assertInstalled(kernel, "VFSDeploymentScanner");
+ KernelRegistry registry = kernel.getRegistry();
+ KernelRegistryEntry entry = registry.getEntry("VFSDeploymentScanner");
+ /** TODO DeploymentScanner scanner = (DeploymentScanner) entry.getTarget();
+ synchronized( scanner )
+ {
+ while( scanner.getScanCount() <= 0 )
+ scanner.wait(10000);
+ }
+ log.info("Notified of scan: "+scanner.getScanCount());
+ */
+
+ // Expected hot deployments
+ assertInstalled(kernel, "VFSClassLoader");
+ assertInstalled(kernel, "TestBean");
+ assertInstalled(kernel, "VFSClassLoader-unpacked");
+ assertInstalled(kernel, "TestBean-unpacked");
+ entry = registry.getEntry("TestBean");
+ Object testBean = entry.getTarget();
+ CodeSource testBeanCS = testBean.getClass().getProtectionDomain().getCodeSource();
+ log.info("TestBean.CS: "+testBeanCS);
+ log.info("TestBean.ClassLoader: "+testBean.getClass().getClassLoader());
+
+
+ // Shutdown
+ main.shutdown();
+ }
+
+ private void assertInstalled(Kernel kernel, String name)
+ {
+ KernelRegistry registry = kernel.getRegistry();
+ KernelRegistryEntry entry = registry.getEntry(name);
+ assertEquals(name+" Installed", ControllerState.INSTALLED, entry.getState());
+ }
+}
Property changes on: trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list