Package org.jboss.metadata

Examples of org.jboss.metadata.BeanMetaData


/*     */   public void setContainer(Container container)
/*     */   {
/* 125 */     super.setContainer(container);
/* 126 */     if (container != null)
/*     */     {
/* 128 */       BeanMetaData beanMetaData = container.getBeanMetaData();
/* 129 */       ApplicationMetaData applicationMetaData = beanMetaData.getApplicationMetaData();
/* 130 */       AssemblyDescriptorMetaData assemblyDescriptor = applicationMetaData.getAssemblyDescriptor();
/* 131 */       this.securityRoles = assemblyDescriptor.getSecurityRoles();
/* 132 */       this.deploymentRoles = assemblyDescriptor.getPrincipalVersusRolesMap();
/*     */
/* 134 */       SecurityIdentityMetaData secMetaData = beanMetaData.getSecurityIdentityMetaData();
/* 135 */       if ((secMetaData != null) && (!secMetaData.getUseCallerIdentity()))
/*     */       {
/* 137 */         String roleName = secMetaData.getRunAsRoleName();
/* 138 */         String principalName = secMetaData.getRunAsPrincipalName();
/*     */
/* 141 */         if (principalName == null) {
/* 142 */           principalName = applicationMetaData.getUnauthenticatedPrincipal();
/*     */         }
/*     */
/* 145 */         Set extraRoleNames = assemblyDescriptor.getSecurityRoleNamesByPrincipal(principalName);
/* 146 */         this.runAsIdentity = new RunAsIdentity(roleName, principalName, extraRoleNames);
/*     */       }
/*     */
/* 149 */       if ((secMetaData != null) && (secMetaData.getUseCallerIdentity())) {
/* 150 */         this.isUseCallerIdentity = true;
/*     */       }
/* 152 */       this.securityManager = container.getSecurityManager();
/* 153 */       this.realmMapping = container.getRealmMapping();
/*     */       try
/*     */       {
/* 159 */         this.ejbTimeout = TimedObject.class.getMethod("ejbTimeout", new Class[] { Timer.class });
/*     */       }
/*     */       catch (NoSuchMethodException ignore)
/*     */       {
/*     */       }
/*     */
/* 165 */       if (this.securityManager != null)
/*     */       {
/* 167 */         this.appSecurityDomain = this.securityManager.getSecurityDomain();
/* 168 */         this.appSecurityDomain = SecurityUtil.unprefixSecurityDomain(this.appSecurityDomain);
/*     */       }
/* 170 */       this.ejbName = beanMetaData.getEjbName();
/* 171 */       this.ejbCS = container.getBeanClass().getProtectionDomain().getCodeSource();
/* 172 */       this.securityManagement = container.getSecurityManagement();
/*     */     }
/*     */   }
View Full Code Here


/*      */
/*      */   public ObjectName getJmxName()
/*      */   {
/*  728 */     if (this.jmxName == null)
/*      */     {
/*  730 */       BeanMetaData beanMetaData = getBeanMetaData();
/*  731 */       if (beanMetaData == null)
/*      */       {
/*  733 */         throw new IllegalStateException("Container metaData is null");
/*      */       }
/*      */
/*  736 */       String jndiName = beanMetaData.getContainerObjectNameJndiName();
/*  737 */       if (jndiName == null)
/*      */       {
/*  739 */         throw new IllegalStateException("Container jndiName is null");
/*      */       }
/*      */
View Full Code Here

/*      */   }
/*      */
/*      */   private void setupEnvironment()
/*      */     throws Exception
/*      */   {
/* 1104 */     BeanMetaData beanMetaData = getBeanMetaData();
/*      */
/* 1107 */     this.log.debug("Begin java:comp/env for EJB: " + beanMetaData.getEjbName());
/* 1108 */     ClassLoader tcl = SecurityActions.getContextClassLoader();
/* 1109 */     this.log.debug("TCL: " + tcl);
/*      */
/* 1111 */     ORB orb = null;
/* 1112 */     HandleDelegate hd = null;
/*      */     try
/*      */     {
/* 1115 */       orb = (ORB)this.server.getAttribute(ORB_NAME, "ORB");
/* 1116 */       hd = (HandleDelegate)this.server.getAttribute(ORB_NAME, "HandleDelegate");
/*      */     }
/*      */     catch (Throwable t)
/*      */     {
/* 1120 */       this.log.debug("Unable to retrieve orb" + t.toString());
/*      */     }
/*      */
/* 1125 */     Context ctx = (Context)new InitialContext().lookup("java:comp");
/* 1126 */     Object id = ENCFactory.getCurrentId();
/* 1127 */     this.log.debug("Using java:comp using id=" + id);
/*      */
/* 1130 */     if (orb != null)
/*      */     {
/* 1132 */       NonSerializableFactory.rebind(ctx, "ORB", orb);
/* 1133 */       this.log.debug("Bound java:comp/ORB for EJB: " + getBeanMetaData().getEjbName());
/*      */
/* 1135 */       NonSerializableFactory.rebind(ctx, "HandleDelegate", hd);
/* 1136 */       this.log.debug("Bound java:comp/HandleDelegate for EJB: " + getBeanMetaData().getEjbName());
/*      */     }
/*      */
/* 1140 */     ctx.bind("TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
/* 1141 */     this.log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
/*      */
/* 1143 */     Context envCtx = ctx.createSubcontext("env");
/*      */
/* 1147 */     Iterator i = beanMetaData.getEnvironmentEntries();
/* 1148 */     while (i.hasNext())
/*      */     {
/* 1150 */       EnvEntryMetaData entry = (EnvEntryMetaData)i.next();
/* 1151 */       this.log.debug("Binding env-entry: " + entry.getName() + " of type: " + entry.getType() + " to value:" + entry.getValue());
/*      */
/* 1153 */       EnvEntryBinder.bindEnvEntry(envCtx, entry);
/*      */     }
/*      */
/* 1159 */     Iterator i = beanMetaData.getEjbReferences();
/* 1160 */     while (i.hasNext())
/*      */     {
/* 1162 */       EjbRefMetaData ref = (EjbRefMetaData)i.next();
/* 1163 */       this.log.debug("Binding an EJBReference " + ref.getName());
/*      */
/* 1165 */       if (ref.getLink() != null)
/*      */       {
/* 1168 */         String linkName = ref.getLink();
/* 1169 */         String jndiName = ref.getJndiName();
/* 1170 */         this.log.debug("Binding " + ref.getName() + " to ejb-link: " + linkName + " -> " + jndiName);
/*      */
/* 1172 */         if (jndiName == null)
/*      */         {
/* 1174 */           String msg = "Failed to resolve ejb-link: " + linkName + " from ejb-ref: " + ref.getName() + " in ejb: " + beanMetaData.getEjbName();
/* 1175 */           throw new DeploymentException(msg);
/*      */         }
/*      */
/* 1178 */         Util.bind(envCtx, ref.getName(), new LinkRef(jndiName));
/*      */       }
/*      */       else
/*      */       {
/* 1184 */         Iterator it = beanMetaData.getInvokerBindings();
/* 1185 */         Reference reference = null;
/* 1186 */         while (it.hasNext())
/*      */         {
/* 1188 */           String invokerBinding = (String)it.next();
/*      */
/* 1190 */           String name = ref.getInvokerBinding(invokerBinding);
/*      */
/* 1192 */           if (name == null)
/* 1193 */             name = ref.getJndiName();
/* 1194 */           if (name == null)
/*      */           {
/* 1196 */             throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml or " + "jndi-name in jboss.xml");
/*      */           }
/*      */
/* 1199 */           StringRefAddr addr = new StringRefAddr(invokerBinding, name);
/* 1200 */           this.log.debug("adding " + invokerBinding + ":" + name + " to Reference");
/*      */
/* 1202 */           if (reference == null)
/*      */           {
/* 1204 */             reference = new Reference("javax.naming.LinkRef", ENCThreadLocalKey.class.getName(), null);
/*      */           }
/* 1206 */           reference.add(addr);
/*      */         }
/*      */
/* 1210 */         if (reference != null)
/*      */         {
/* 1212 */           if (ref.getJndiName() != null)
/*      */           {
/* 1215 */             StringRefAddr addr = new StringRefAddr("default", ref.getJndiName());
/* 1216 */             reference.add(addr);
/*      */           }
/* 1218 */           if ((reference.size() == 1) && (reference.get("default") == null))
/*      */           {
/* 1224 */             StringRefAddr addr = (StringRefAddr)reference.get(0);
/* 1225 */             String target = (String)addr.getContent();
/* 1226 */             StringRefAddr addr1 = new StringRefAddr("default", target);
/* 1227 */             reference.add(addr1);
/*      */           }
/* 1229 */           Util.bind(envCtx, ref.getName(), reference);
/*      */         }
/*      */         else
/*      */         {
/* 1234 */           if (ref.getJndiName() == null)
/*      */           {
/* 1236 */             throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml " + "or jndi-name in jboss.xml");
/*      */           }
/* 1238 */           Util.bind(envCtx, ref.getName(), new LinkRef(ref.getJndiName()));
/*      */         }
/*      */
/*      */       }
/*      */
/*      */     }
/*      */
/* 1246 */     Iterator i = beanMetaData.getEjbLocalReferences();
/* 1247 */     while (i.hasNext())
/*      */     {
/* 1249 */       EjbLocalRefMetaData ref = (EjbLocalRefMetaData)i.next();
/* 1250 */       String refName = ref.getName();
/* 1251 */       this.log.debug("Binding an EJBLocalReference " + ref.getName());
/*      */
/* 1253 */       if (ref.getLink() != null)
/*      */       {
/* 1256 */         this.log.debug("Binding " + refName + " to bean source: " + ref.getLink());
/*      */
/* 1258 */         String jndiName = ref.getJndiName();
/*      */
/* 1260 */         Util.bind(envCtx, ref.getName(), new LinkRef(jndiName));
/*      */       }
/*      */       else
/*      */       {
/* 1265 */         if (ref.getJndiName() == null)
/*      */         {
/* 1267 */           throw new DeploymentException("ejb-local-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml " + "or local-jndi-name in jboss.xml");
/*      */         }
/* 1269 */         Util.bind(envCtx, ref.getName(), new LinkRef(ref.getJndiName()));
/*      */       }
/*      */
/*      */     }
/*      */
/* 1276 */     ClassLoader loader = this.unit.getClassLoader();
/* 1277 */     UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(this.unit.getRoot());
/* 1278 */     Iterator serviceReferences = beanMetaData.getServiceReferences();
/* 1279 */     if (serviceReferences != null)
/*      */     {
/* 1281 */       while (serviceReferences.hasNext())
/*      */       {
/* 1283 */         ServiceReferenceMetaData sref = (ServiceReferenceMetaData)serviceReferences.next();
/* 1284 */         String refName = sref.getServiceRefName();
/* 1285 */         new ServiceReferenceHandler().bindServiceRef(envCtx, refName, vfsRoot, loader, sref);
/*      */       }
/*      */
/*      */     }
/*      */
/* 1292 */     Iterator i = beanMetaData.getResourceReferences();
/*      */
/* 1295 */     ApplicationMetaData application = beanMetaData.getApplicationMetaData();
/*      */
/* 1297 */     while (i.hasNext())
/*      */     {
/* 1299 */       ResourceRefMetaData ref = (ResourceRefMetaData)i.next();
/*      */
/* 1301 */       String resourceName = ref.getResourceName();
/* 1302 */       String finalName = application.getResourceByName(resourceName);
/* 1303 */       String resType = ref.getType();
/*      */
/* 1306 */       if (finalName == null) {
/* 1307 */         finalName = ref.getJndiName();
/*      */       }
/* 1309 */       if ((finalName == null) && (!resType.equals("java.net.URL")))
/*      */       {
/* 1314 */         if (ref.getType().equals("javax.sql.DataSource"))
/*      */         {
/* 1317 */           Context dsCtx = new InitialContext();
/*      */           try
/*      */           {
/* 1321 */             dsCtx.lookup("java:/DefaultDS");
/* 1322 */             finalName = "java:/DefaultDS";
/*      */           }
/*      */           catch (Exception e)
/*      */           {
/* 1326 */             this.log.debug("failed to lookup DefaultDS; ignoring", e);
/*      */           }
/*      */           finally
/*      */           {
/* 1330 */             dsCtx.close();
/*      */           }
/*      */
/*      */         }
/*      */
/* 1336 */         if (finalName == null)
/*      */         {
/* 1338 */           this.log.warn("No resource manager found for " + ref.getResourceName());
/* 1339 */           continue;
/*      */         }
/*      */       }
/*      */
/* 1343 */       if (resType.equals("java.net.URL"))
/*      */       {
/* 1346 */         if (ref.getResURL() != null)
/*      */         {
/* 1349 */           this.log.debug("Binding URL: " + ref.getRefName() + " to JDNI ENC as: " + ref.getResURL());
/* 1350 */           URL resURL = new URL(ref.getResURL());
/* 1351 */           Util.bind(envCtx, ref.getRefName(), resURL);
/*      */         }
/*      */         else
/*      */         {
/* 1355 */           this.log.debug("Binding URL: " + ref.getRefName() + " to: " + finalName);
/* 1356 */           Object bind = null;
/* 1357 */           if (ref.getJndiName() != null)
/*      */           {
/* 1360 */             bind = new LinkRef(finalName);
/*      */           }
/*      */           else
/*      */           {
/* 1365 */             bind = new URL(finalName);
/*      */           }
/* 1367 */           Util.bind(envCtx, ref.getRefName(), bind);
/*      */         }
/*      */
/*      */       }
/*      */       else
/*      */       {
/* 1373 */         this.log.debug("Binding resource manager: " + ref.getRefName() + " to JDNI ENC as: " + finalName);
/* 1374 */         Util.bind(envCtx, ref.getRefName(), new LinkRef(finalName));
/*      */       }
/*      */
/*      */     }
/*      */
/* 1381 */     Iterator i = beanMetaData.getResourceEnvReferences();
/* 1382 */     while (i.hasNext())
/*      */     {
/* 1384 */       ResourceEnvRefMetaData resRef = (ResourceEnvRefMetaData)i.next();
/* 1385 */       String encName = resRef.getRefName();
/* 1386 */       String jndiName = resRef.getJndiName();
/*      */
/* 1388 */       this.log.debug("Binding env resource: " + encName + " to JDNI ENC as: " + jndiName);
/* 1389 */       Util.bind(envCtx, encName, new LinkRef(jndiName));
/*      */     }
/*      */
/* 1395 */     Iterator i = beanMetaData.getMessageDestinationReferences();
/*      */
/* 1397 */     while (i.hasNext())
/*      */     {
/* 1399 */       MessageDestinationRefMetaData ref = (MessageDestinationRefMetaData)i.next();
/*      */
/* 1401 */       String refName = ref.getRefName();
/* 1402 */       String jndiName = ref.getJNDIName();
/* 1403 */       String link = ref.getLink();
/* 1404 */       if (link != null)
/*      */       {
/* 1406 */         if (jndiName == null)
/*      */         {
/* 1408 */           MessageDestinationMetaData messageDestination = getMessageDestination(link);
/* 1409 */           if (messageDestination == null) {
/* 1410 */             throw new DeploymentException("message-destination-ref '" + refName + "' message-destination-link '" + link + "' not found and no jndi-name in jboss.xml");
/*      */           }
/*      */
/* 1414 */           String linkJNDIName = messageDestination.getJndiName();
/* 1415 */           if (linkJNDIName == null)
/* 1416 */             this.log.warn("message-destination '" + link + "' has no jndi-name in jboss.xml");
/*      */           else
/* 1418 */             jndiName = linkJNDIName;
/*      */         }
/*      */         else
/*      */         {
/* 1422 */           this.log.warn("message-destination-ref '" + refName + "' ignoring message-destination-link '" + link + "' because it has a jndi-name in jboss.xml");
/*      */         }
/* 1424 */       } else if (jndiName == null)
/* 1425 */         throw new DeploymentException("message-destination-ref '" + refName + "' has no message-destination-link in ejb-jar.xml and no jndi-name in jboss.xml");
/* 1426 */       Util.bind(envCtx, refName, new LinkRef(jndiName));
/*      */     }
/*      */
/* 1434 */     String securityDomain = this.metaData.getContainerConfiguration().getSecurityDomain();
/* 1435 */     if (securityDomain == null)
/* 1436 */       securityDomain = this.metaData.getApplicationMetaData().getSecurityDomain();
/* 1437 */     if (securityDomain != null)
/*      */     {
/* 1439 */       this.log.debug("Binding securityDomain: " + securityDomain + " to JDNI ENC as: security/security-domain");
/*      */
/* 1441 */       Util.bind(envCtx, "security/security-domain", new LinkRef(securityDomain));
/* 1442 */       Util.bind(envCtx, "security/subject", new LinkRef(securityDomain + "/subject"));
/* 1443 */       Util.bind(envCtx, "security/realmMapping", new LinkRef(securityDomain + "/realmMapping"));
/* 1444 */       Util.bind(envCtx, "security/authorizationMgr", new LinkRef(securityDomain + "/authorizationMgr"));
/*      */     }
/*      */
/* 1447 */     this.log.debug("End java:comp/env for EJB: " + beanMetaData.getEjbName());
/*      */   }
View Full Code Here

/*     */   public void create()
/*     */     throws Exception
/*     */   {
/*  71 */     super.start();
/*     */
/*  73 */     BeanMetaData md = getContainer().getBeanMetaData();
/*  74 */     this.ejbName = md.getEjbName();
/*     */
/*  77 */     this.callLogging = md.getContainerConfiguration().getCallLogging();
/*     */   }
View Full Code Here

/*     */
/*     */   public void create()
/*     */     throws Exception
/*     */   {
/* 147 */     super.create();
/* 148 */     BeanMetaData bmd = getContainer().getBeanMetaData();
/* 149 */     this.exceptionRollback = bmd.getExceptionRollback();
/* 150 */     if (!this.exceptionRollback)
/* 151 */       this.exceptionRollback = bmd.getApplicationMetaData().getExceptionRollback();
/*     */   }
View Full Code Here

   {
      List<EJBMetaData> beans = new ArrayList<EJBMetaData>();
      Iterator it = metaData.getEnterpriseBeans();
      while (it.hasNext())
      {
         BeanMetaData bmd = (BeanMetaData)it.next();
         EJBMetaData ubmd = buildUnifiedBeanMetaData(bmd);
         if (ubmd != null)
         {
            beans.add(ubmd);
         }
View Full Code Here

         {
            String ejbLink = pcmd.getEjbLink();
            if (ejbLink == null)
               throw new IllegalStateException("ejb-link cannot be null");

            BeanMetaData beanMetaData = appmd.getBeanByEjbName(ejbLink);
            if (beanMetaData == null)
               throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);

            String ejbClass = beanMetaData.getEjbClass();
           
            // Create the endpoint
            Endpoint ep = newEndpoint(ejbClass);
            ep.setShortName(ejbLink);
            service.addEndpoint(ep);
View Full Code Here

   /**
    * create the service, do expensive operations etc
    */
   public void create () throws Exception
   {
      BeanMetaData bmd = con.getBeanMetaData();
      ClusterConfigMetaData ccmd = bmd.getClusterConfigMetaData ();
      String partitionName = ccmd.getPartitionName();
      String name = "jboss:service=DistributedState,partitionName="+partitionName;
      ds = (DistributedState)org.jboss.system.Registry.lookup (name);

      String ejbName = bmd.getEjbName();
      this.DS_CATEGORY = "CMPClusteredInMemoryPersistenceManager-" + ejbName;

      idField = con.getBeanClass ().getField ("id");

      try
View Full Code Here

TOP

Related Classes of org.jboss.metadata.BeanMetaData

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.