Package org.jboss.system.metadata

Examples of org.jboss.system.metadata.ServiceDeployment


   }
  
   @Override
   protected ManagedObject getComponent(Object attachment, PersistedComponent component, boolean create)
   {
      ServiceDeployment deployment = (ServiceDeployment) attachment;
      ServiceMetaData service = null;
      List<ServiceMetaData> services = deployment.getServices();
      if(services == null)
      {
         services = new ArrayList<ServiceMetaData>();
         deployment.setServices(services);
      }
      if(services != null && services.isEmpty() == false)
      {
         for(ServiceMetaData metaData : services)
         {
            if(metaData.getObjectName().getCanonicalName().equals(component.getOriginalName()))
            {
               service = metaData;
               break;
            }
         }
      }
      if(service == null && create)
      {
         // Create a new empty service meta data
         service = createEmptyServiceMetaData(component);
         deployment.getServices().add(service);
      }
      if(service == null)
      {
         throw new IllegalStateException("could not find service with name " + component.getOriginalName());
      }
View Full Code Here


   }

   @Override
   protected void removeComponent(Object attachment, PersistedComponent component)
   {
      ServiceDeployment deployment = (ServiceDeployment) attachment;
      List<ServiceMetaData> deploymentServices = deployment.getServices();
      List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
      if(deploymentServices != null && deploymentServices.isEmpty() == false)
      {
         for(ServiceMetaData metaData : deploymentServices)
         {
            // Ignore the removed bean
            if(metaData.getObjectName().getCanonicalName().
                  equals(component.getOriginalName()) == false)
               services.add(metaData);
         }
      }
      deployment.setServices(services);
   }
View Full Code Here

/*  98 */     String name = unit.getSimpleName();
/*  99 */     if (name.endsWith("-dsf.xml"))
/*     */     {
/* 101 */       Map attachments = unit.getTransientManagedObjects().getAttachments();
/* 102 */       this.log.info(name + " attachments: " + attachments);
/* 103 */       ServiceDeployment service = (ServiceDeployment)unit.getAttachment(ServiceDeployment.class);
/* 104 */       if (service == null)
/* 105 */         throw new DeploymentException("Failed to find ServiceDeployment in " + unit.getName());
/* 106 */       List services = service.getServices();
/*     */
/* 108 */       if (services.size() != 1)
/* 109 */         throw new DeploymentException("Expected only 1 ServiceMetaData but saw " + services.size() + " in " + unit.getName());
/* 110 */       ServiceMetaData dsMetaData = (ServiceMetaData)services.get(0);
/* 111 */       String attachName = ServiceMetaData.class.getName();
View Full Code Here

/*     */   }
/*     */
/*     */   protected ServiceDeployment parse(VFSDeploymentUnit unit, VirtualFile file, Document document)
/*     */     throws Exception
/*     */   {
/* 139 */     ServiceDeployment deployment = new ServiceDeployment();
/* 140 */     DataSourceDeployment ds = new DataSourceDeployment();
/* 141 */     ds.parse(document);
/*     */
/* 143 */     ServiceMetaData dsMbean = createDsServiceMetaData(ds);
/* 144 */     ArrayList services = new ArrayList();
/* 145 */     services.add(dsMbean);
/* 146 */     deployment.setServices(services);
/*     */
/* 148 */     ComponentType type = new ComponentType("FakeDataSource", "LocalTx");
/* 149 */     unit.addAttachment(ComponentType.class, type);
/*     */
/* 151 */     return deployment;
View Full Code Here

/*     */
/*     */   public void deploy(DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup group)
/*     */     throws DeploymentException
/*     */   {
/* 149 */     List deployments = group.getDeployments();
/* 150 */     ServiceDeployment serviceDeployment = new ServiceDeployment();
/* 151 */     List componentServices = new ArrayList();
/* 152 */     List serviceDefintion = group.getServices();
/*     */
/* 154 */     serviceDeployment.setName(unit.getName() + " services");
/*     */
/* 156 */     for (ServiceMetaData data : serviceDefintion)
/*     */     {
/* 158 */       componentServices.add(data);
/*     */     }
/*     */
/* 161 */     ComponentType type = null;
/* 162 */     for (Iterator i$ = deployments.iterator(); i$.hasNext(); ) { data = (ManagedConnectionFactoryDeploymentMetaData)i$.next();
/*     */
/* 165 */       if (type == null)
/*     */       {
/* 167 */         if ((data instanceof LocalDataSourceDeploymentMetaData))
/* 168 */           type = KnownComponentTypes.DataSourceTypes.LocalTx.getType();
/* 169 */         if ((data instanceof NoTxDataSourceDeploymentMetaData))
/* 170 */           type = KnownComponentTypes.DataSourceTypes.NoTx.getType();
/* 171 */         if ((data instanceof XADataSourceDeploymentMetaData)) {
/* 172 */           type = KnownComponentTypes.DataSourceTypes.XA.getType();
/*     */         }
/*     */       }
/* 175 */       for (AbstractBuilder builder : this.builders)
/*     */       {
/* 177 */         ServiceMetaData candidate = builder.build(data);
/*     */
/* 179 */         if (candidate != null)
/*     */         {
/* 181 */           componentServices.add(candidate);
/*     */         }
/*     */       }
/*     */     }
/*     */     ManagedConnectionFactoryDeploymentMetaData data;
/* 186 */     serviceDeployment.setServices(componentServices);
/* 187 */     unit.addAttachment(ServiceDeployment.class, serviceDeployment);
/* 188 */     if (type != null)
/* 189 */       unit.addAttachment(ComponentType.class, type);
/*     */   }
View Full Code Here

/* 78 */     String name = unit.getSimpleName();
/* 79 */     if (name.endsWith("-dsf.xml"))
/*    */     {
/* 81 */       Map attachments = unit.getTransientManagedObjects().getAttachments();
/* 82 */       log.info(name + " attachments: " + attachments);
/* 83 */       ServiceDeployment service = (ServiceDeployment)unit.getAttachment(ServiceDeployment.class);
/* 84 */       if (service == null)
/* 85 */         throw new DeploymentException("Failed to find ServiceDeployment in " + unit.getName());
/* 86 */       List services = service.getServices();
/*    */
/* 88 */       if (services.size() != 1)
/* 89 */         throw new DeploymentException("Expected only 1 ServiceMetaData but saw " + services.size() + " in " + unit.getName());
/* 90 */       ServiceMetaData dsMetaData = (ServiceMetaData)services.get(0);
/* 91 */       String attachName = ServiceMetaData.class.getName();
View Full Code Here

/*     */
/*     */   protected ServiceDeployment parse(VFSDeploymentUnit unit, VirtualFile file, Document document)
/*     */     throws Exception
/*     */   {
/*  97 */     ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
/*  98 */     ServiceDeployment parsed = parser.parse();
/*  99 */     String name = file.toURI().toString();
/* 100 */     parsed.setName(name);
/*     */
/* 102 */     List classPaths = parsed.getClassPaths();
/* 103 */     if (classPaths != null) {
/* 104 */       processXMLClasspath(unit, classPaths);
/*     */     }
/* 106 */     LoaderRepositoryFactory.LoaderRepositoryConfig config = parsed.getLoaderRepositoryConfig();
/* 107 */     if (config != null)
/* 108 */       unit.addAttachment(LoaderRepositoryFactory.LoaderRepositoryConfig.class.getName(), config);
/* 109 */     return parsed;
/*     */   }
View Full Code Here

/*     */     }
/*     */
/*     */     try
/*     */     {
/* 186 */       DeploymentUnit unit = context.getDeploymentUnit();
/* 187 */       ServiceDeployment deployment = (ServiceDeployment)unit.getAttachment(ServiceDeployment.class);
/* 188 */       if (deployment != null)
/*     */       {
/* 190 */         LoaderRepositoryFactory.LoaderRepositoryConfig config = (LoaderRepositoryFactory.LoaderRepositoryConfig)unit.getAttachment(LoaderRepositoryFactory.LoaderRepositoryConfig.class);
/* 191 */         if (config != null)
/* 192 */           LoaderRepositoryFactory.destroyLoaderRepository(server, config.repositoryName);
View Full Code Here

/*     */   }
/*     */
/*     */   public void updateTemplateDeployment(VFSDeployment ctx, DeploymentTemplateInfo values)
/*     */     throws Exception
/*     */   {
/* 106 */     ServiceDeployment service = new ServiceDeployment();
/* 107 */     ArrayList services = new ArrayList();
/* 108 */     DataSourceDeployment ds = new DataSourceDeployment();
/* 109 */     ds.parse(values.getProperties());
/* 110 */     ServiceMetaData dsMetaData = this.deployer.createDsServiceMetaData(ds);
/* 111 */     services.add(dsMetaData);
/* 112 */     service.setServices(services);
/*     */   }
View Full Code Here

/*    */   }
/*    */
/*    */   protected ServiceDeployment parse(VFSDeploymentUnit unit, VirtualFile file, Document document) throws Exception
/*    */   {
/* 48 */     ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
/* 49 */     ServiceDeployment parsed = parser.parse();
/* 50 */     String name = file.toURI().toString();
/* 51 */     parsed.setName(name);
/* 52 */     return parsed;
/*    */   }
View Full Code Here

TOP

Related Classes of org.jboss.system.metadata.ServiceDeployment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.