public static String capitalize(String name) { // EJB2.0 proposed final draft says that CMP/CMR field names // must begin with a lower case letter. if ( Character.isUpperCase(name.charAt(0)) ) { throw new DeploymentException("CMP/CMR field "+name+" must start with a lower case character."); } else { char chars[] = name.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); } }
public static String capitalize(String name) { // EJB2.0 proposed final draft says that CMP/CMR field names // must begin with a lower case letter. if ( Character.isUpperCase(name.charAt(0)) ) { throw new DeploymentException("CMP/CMR field "+name+" must start with a lower case character."); } else { char chars[] = name.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); } }
/** * Return the CMRFieldInfo object for the given CMR field */ public CMRFieldInfo getCMRFieldInfoByName(String fieldName) { CMRFieldInfo[] cmrf = this.getCMRFieldInfo(); for ( int i=0; i<cmrf.length; i++ ) { if ( cmrf[i].name.equals(fieldName) ) return cmrf[i]; } throw new DeploymentException("CMRFieldInfo not found for field "+fieldName); }
/** * Return the CMRFieldInfo object for the given CMR field */ public CMRFieldInfo getCMRFieldInfoByName(String fieldName) { CMRFieldInfo[] cmrf = this.getCMRFieldInfo(); for ( int i=0; i<cmrf.length; i++ ) { if ( cmrf[i].name.equals(fieldName) ) return cmrf[i]; } throw new DeploymentException("CMRFieldInfo not found for field "+fieldName); }
/** * Return the PersistentFieldInfo object for the given CMP/fkey field */ public PersistentFieldInfo getPersistentFieldInfoByName(String fieldName) { if ( !fieldInfoInitialized ) initializeFieldInfo(); for ( int i=0; i<persFieldInfo.length; i++ ) { if ( persFieldInfo[i].name.equals(fieldName) ) return persFieldInfo[i]; } throw new DeploymentException("PersistentFieldInfo not found for field "+fieldName); }
/** * Return PersistentFieldInfo object for the given pkey field. */ public PersistentFieldInfo getPkeyFieldInfoByName(String fieldName) { if ( !fieldInfoInitialized ) initializeFieldInfo(); for ( int i=0; i<pkeyFieldInfo.length; i++ ) { if ( pkeyFieldInfo[i].name.equals(fieldName) ) return pkeyFieldInfo[i]; } throw new DeploymentException("PersistentFieldInfo not found for pkey field "+fieldName); }
/** * Return PersistentFieldInfo object for the given pkey field. */ public PersistentFieldInfo getPkeyFieldInfoByName(String fieldName) { if ( !fieldInfoInitialized ) initializeFieldInfo(); for ( int i=0; i<pkeyFieldInfo.length; i++ ) { if ( pkeyFieldInfo[i].name.equals(fieldName) ) return pkeyFieldInfo[i]; } throw new DeploymentException("PersistentFieldInfo not found for pkey field "+fieldName); }
/** * Return the PersistentFieldInfo object for the given CMP/fkey field */ public PersistentFieldInfo getPersistentFieldInfoByName(String fieldName) { if ( !fieldInfoInitialized ) initializeFieldInfo(); for ( int i=0; i<persFieldInfo.length; i++ ) { if ( persFieldInfo[i].name.equals(fieldName) ) return persFieldInfo[i]; } throw new DeploymentException("PersistentFieldInfo not found for field "+fieldName); }
private static void verify(File inWebDir, File outWebDir) throws DeploymentException { // inWebDir must exist, outWebDir must either exist or be creatable if (!FileUtils.safeIsDirectory(inWebDir)) { throw new DeploymentException("inWebDir is not a directory: " + inWebDir); } if (!FileUtils.safeIsDirectory(outWebDir)) { outWebDir.mkdirs(); if (!FileUtils.safeIsDirectory(outWebDir)) { throw new DeploymentException("outWebDir is not a directory, and it can't be created: " + outWebDir); } } }
private Class getClass(String className) { try { return getEjbBundleDescriptor().getClassLoader().loadClass(className); } catch ( Exception ex ) { throw new DeploymentException(ex); } }
private Class getClass(String className) { try { return getEjbBundleDescriptor().getClassLoader().loadClass(className); } catch ( Exception ex ) { throw new DeploymentException(ex); } }
/** * Return array of CMRFieldInfo objects for all CMR fields. */ public CMRFieldInfo[] getCMRFieldInfo() { if ( cmrFieldInfo == null ) { try { initCMRFieldStuff(); } catch ( Exception ex ) { DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.invalidDescriptorMappingFailure", new Object[] {ex.toString()}); throw new DeploymentException(ex); } } return cmrFieldInfo; }
/** * Return array of CMRFieldInfo objects for all CMR fields. */ public CMRFieldInfo[] getCMRFieldInfo() { if ( cmrFieldInfo == null ) { try { initCMRFieldStuff(); } catch ( Exception ex ) { DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.invalidDescriptorMappingFailure", new Object[] {ex.toString()}); throw new DeploymentException(ex); } } return cmrFieldInfo; }
private void handleFailure(String appName, Class[] tasks, boolean deployment, PaaSDeploymentState state, PaaSDeploymentContext pc, Exception e) { logger.log(Level.WARNING, localStrings.getString("failure.handling",state.getClass().getSimpleName()),e); if(deployment){ DeploymentException de = null; if(isAtomicDeploymentEnabled()){ rollbackDeployment(pc, state, DEPLOYMENT_STATES); de = new DeploymentException("Failure while deploying application [ "+appName+" ], " + "rolled back all deploy operations."); }else{ de = new DeploymentException("Failure while deploying application [ "+appName+" ]. Atomic" + "deployment is disabled, manual cleanup is required"); } de.initCause(e); throw de; }else{ DeploymentException de = new DeploymentException("Failure while undeploying application [ "+appName+" ]." ); de.initCause(e); throw de; } }
public Class getStateClass() { if ( stateClass == null ) { stateClass = getPersistentClass(); if ( parentDesc.isEJB20() ) { if( !Modifier.isAbstract(stateClass.getModifiers()) ) { throw new DeploymentException("2.x CMP bean class " + stateClass.getName() + " must be decleared abstract " + "or cmp-version for the corresponding bean must be set to 1.x."); } String stateClassName = parentDesc.getStateImplClassName(); stateClass = getClass(stateClassName); } } return stateClass; }
public Class getStateClass() { if ( stateClass == null ) { stateClass = getPersistentClass(); if ( parentDesc.isEJB20() ) { if( !Modifier.isAbstract(stateClass.getModifiers()) ) { throw new DeploymentException("2.x CMP bean class " + stateClass.getName() + " must be decleared abstract " + "or cmp-version for the corresponding bean must be set to 1.x."); } String stateClassName = parentDesc.getStateImplClassName(); stateClass = getClass(stateClassName); } } return stateClass; }
public void event(Event event) { try { if (event.is(EventTypes.SERVER_STARTUP)) { onStartup(); } else if (event.is(EventTypes.SERVER_READY)) { onReady(); } else if (event.is(EventTypes.PREPARE_SHUTDOWN)) { onShutdown(); } } catch (Exception e) { throw new DeploymentException(e); } }
@Override protected void generateArtifacts(DeploymentContext dc) throws DeploymentException { OpsParams params = dc.getCommandParameters(OpsParams.class); if (params.origin != OpsParams.Origin.deploy) { return; } String appName = params.name(); try { Application app = dc.getModuleMetaData(Application.class); Set<WebBundleDescriptor> webDesc = app.getWebBundleDescriptors(); if (webDesc == null) { return; } for (WebBundleDescriptor webBD : webDesc) { loadPolicy(webBD, false); } } catch (Exception se) { String msg = "Error in generating security policy for " + appName; throw new DeploymentException(msg, se); } }
/** * commits ejb policy contexts. * This should occur in EjbApplication, being done here until * issue with ejb-ejb31-singleton-multimoduleApp.ear is resolved * @param ejbs */ private void commitEjbs(Application app) throws DeploymentException { Set<EjbBundleDescriptor> ejbDescriptors = app.getBundleDescriptors(EjbBundleDescriptor.class); try { for (EjbBundleDescriptor ejbBD : ejbDescriptors) { String pcid = SecurityUtil.getContextID(ejbBD); ejbProbeProvider.policyCreationStartedEvent(pcid); SecurityUtil.generatePolicyFile(pcid); ejbProbeProvider.policyCreationEndedEvent(pcid); ejbProbeProvider.policyCreationEvent(pcid); } } catch (Exception se) { String msg = "Error in committing security policy for ejbs of " + app.getRegistrationName(); throw new DeploymentException(msg, se); } }
/** * commits ejb policy contexts. * This should occur in EjbApplication, being done here until * issue with ejb-ejb31-singleton-multimoduleApp.ear is resolved * @param ejbs */ private void commitEjbs(Application app) throws DeploymentException { Set<EjbBundleDescriptor> ejbDescriptors = app.getEjbBundleDescriptors(); try { for (EjbBundleDescriptor ejbBD : ejbDescriptors) { String pcid = SecurityUtil.getContextID(ejbBD); ejbProbeProvider.policyCreationStartedEvent(pcid); SecurityUtil.generatePolicyFile(pcid); ejbProbeProvider.policyCreationEndedEvent(pcid); ejbProbeProvider.policyCreationEvent(pcid); } } catch (Exception se) { String msg = "Error in committing security policy for ejbs of " + app.getRegistrationName(); throw new DeploymentException(msg, se); } }