List of usage examples for org.springframework.context ApplicationContextException ApplicationContextException
public ApplicationContextException(String msg, Throwable cause)
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsCheckin2(String serverId, String vcsConnectionId, String vcsResourcePath, String vcsResourceType, String vcsMessage, String pathToVcsXML, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsCheckin2() with following params " + " serverName: " + serverId + " vcsConnectionId: " + vcsConnectionId + ", vcsResourcePath: " + vcsResourcePath + ", vcsMessage: " + vcsMessage + ", pathToServersXML: " + pathToServersXML); }//from w ww. j a v a 2 s. c o m try { // Set the VCS Module XML Connection Properties in the JVM Environment setVCSConnectionProperties(vcsConnectionId, pathToVcsXML); vcsConnId = vcsConnectionId; // Invoke the command vcsCheckin(serverId, vcsResourcePath, vcsResourceType, vcsMessage, pathToServersXML, vcsUser, vcsPassword); } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.TriggerManagerImpl.java
private List<TriggerScheduleType> getTriggerSchedules(TriggerScheduleListType triggerScheduleListType) { try {/*from w w w . ja v a 2 s .c om*/ if (triggerScheduleListType != null && triggerScheduleListType.getSchedule() != null && !triggerScheduleListType.getSchedule().isEmpty()) { return triggerScheduleListType.getSchedule(); } } catch (CompositeException e) { logger.error("Error while parsing Trigger Module XML", e); throw new ApplicationContextException(e.getMessage(), e); } return null; }
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsCheckins(String serverId, String vcsIds, String pathToVcsXML, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsCheckins() with following params " + " serverName: " + serverId + ", vcsIds: " + vcsIds + ", pathToVcsXML: " + pathToVcsXML + ", pathToServersXML: " + pathToServersXML);/*ww w .j a va2 s. c o m*/ } try { // Set the global suppress and debug flags for this class based on properties found in the property file setGlobalProperties(); if (!vcsV2Method) vcsConnId = null; // Redirect processing to if (vcsMultiUserTopology) { logger.info( "Multi-User Direct Access Topology is configured. Redirecting to vcsForcedCheckins()."); vcsForcedCheckins(serverId, vcsIds, pathToVcsXML, pathToServersXML, vcsUser, vcsPassword); } else { executeVCS(VCSManager.action.CHECKIN.name(), serverId, vcsIds, pathToVcsXML, pathToServersXML, vcsUser, vcsPassword); } } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsCheckins2(String serverId, String vcsConnectionId, String vcsIds, String pathToVcsXML, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsCheckins2() with following params " + " serverName: " + serverId + " vcsConnectionId: " + vcsConnectionId + ", vcsIds: " + vcsIds + ", pathToVcsXML: " + pathToVcsXML + ", pathToServersXML: " + pathToServersXML); }/*www.j ava 2 s . co m*/ try { // Set the VCS Module XML Connection Properties in the JVM Environment setVCSConnectionProperties(vcsConnectionId, pathToVcsXML); vcsConnId = vcsConnectionId; // Invoke the command vcsCheckins(serverId, vcsIds, pathToVcsXML, pathToServersXML, vcsUser, vcsPassword); } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.ResourceManagerImpl.java
private List<ResourceType> getResources(String serverId, String resources, String pathToResourceXML, String pathToServersXML) { // validate incoming arguments if (serverId == null || serverId.trim().length() == 0 || resources == null || resources.trim().length() == 0 || pathToServersXML == null || pathToServersXML.trim().length() == 0 || pathToResourceXML == null || pathToResourceXML.trim().length() == 0) { throw new ValidationException("Invalid Arguments"); }/*from www . j av a2 s . c o m*/ try { //using jaxb convert xml to corresponding java objects ResourceModule resourceModuleType = (ResourceModule) XMLUtils.getModuleTypeFromXML(pathToResourceXML); if (resourceModuleType != null && resourceModuleType.getResource() != null && !resourceModuleType.getResource().isEmpty()) { return resourceModuleType.getResource(); } } catch (CompositeException e) { logger.error("Error while parsing resource xml", e); throw new ApplicationContextException(e.getMessage(), e); } return null; }
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsForcedCheckin(String serverId, String vcsResourcePath, String vcsResourceType, String vcsMessage, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsForcedCheckin() with following params " + " serverName: " + serverId + ", vcsResourcePath: " + vcsResourcePath + ", vcsMessage: " + vcsMessage + ", pathToServersXML: " + pathToServersXML); }// w w w . java 2s . c om try { String prefix = "vcsForcedCheckin"; String actionName = "vcsForcedCheckin"; // Set the Module Action Objective String s1 = (vcsResourcePath == null) ? "no_vcsResourcePath" : vcsResourcePath; System.setProperty("MODULE_ACTION_OBJECTIVE", "FORCED_CHECKIN : " + s1); // Set the global suppress and debug flags for this class based on properties found in the property file setGlobalProperties(); CommonUtils.writeOutput("***** BEGIN COMMAND: " + actionName + " *****", prefix, "-info", logger, debug1, debug2, debug3); CommonUtils.writeOutput("", prefix, "-info", logger, debug1, debug2, debug3); /***************************************** * VALIDATE COMMAND-LINE VARIABLES *****************************************/ // Validate the arguments if (serverId == null || serverId.trim().length() == 0 || vcsResourcePath == null || vcsResourcePath.trim().length() == 0 || vcsMessage == null || vcsMessage.trim().length() == 0 || pathToServersXML == null || pathToServersXML.trim().length() == 0) { throw new ValidationException("Invalid Arguments for " + prefix); } // Validate whether the files exist or not if (!CommonUtils.fileExists(pathToServersXML)) { throw new ValidationException("File [" + pathToServersXML + "] does not exist."); } /***************************************** * PRINT OUT COMMAND-LINE VARIABLES *****************************************/ // Print out Debug input parameters CommonUtils.writeOutput("", prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput("---Input Variables from deployment plan file: ", prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" SERVER_ID= " + serverId, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" SERVER_PATH= " + pathToServersXML, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" VCONN_ID= " + vcsConnId, prefix, "-debug2", logger, debug1, debug2, debug3); // Get the server info from the servers.xml file CompositeServer serverInfo = WsApiHelperObjects.getServerLogger(serverId, pathToServersXML, prefix, logger); serverInfo = validateServerProperties(serverInfo); // Ping the Server to make sure it is alive and the values are correct. WsApiHelperObjects.pingServer(serverInfo, true); /***************************************** * INITIALIZE VCS STRUCTURE VARIABLE *****************************************/ // Initialize a new VCS structure for passing to the methods VcsStruct vcsStruct = (new VCSManagerImpl()).new VcsStruct(); // Load the VCS structure and decrypt the vcs password -- Retrieve properties from the deploy.properties file vcsStruct.loadVcs(prefix, vcsUser, vcsPassword); /***************************************** * DISPLAY/VALIDATE VCS VARIABLES *****************************************/ // Validate, Create VCS Workspace and Temp directories vcsStruct.validateVcs(prefix); // Resolve Absolute paths vcsStruct.resolveCanonicalPathsVcs(prefix); // Display VCS variables vcsStruct.displayVcs(prefix); String origResourceType = null; String origResourcePath = null; //******************************************************************************************** // Validate vcsResourcePath settings prior to invocation of vcs scripts //******************************************************************************************** origResourcePath = vcsResourcePath; if (vcsResourcePath == null || vcsResourcePath.length() == 0) { throw new ValidationException("VCS Resource Path is null or empty."); } // Encode the VCS resource path vcsResourcePath = ResourceNameCodec.encode(vcsResourcePath); vcsResourcePath = vcsResourcePath.replaceAll("_002F", "/"); //******************************************************************************************** // Validate vcsResourceType settings prior to invocation of vcs scripts //******************************************************************************************** // Get the Resource Type for the VCS Resource Path origResourceType = vcsResourceType; vcsResourceType = getConvertedVcsResourceType(vcsResourceType); // Validate the resource type if (vcsResourceType == null || vcsResourceType.length() == 0) { throw new ValidationException("VCS Resource Type is null or empty."); } if (!validResourceTypes.contains(vcsResourceType)) { throw new ValidationException("VCS Resource Type=[" + vcsResourceType + "] is not valid. Valid Resource Types=[" + validResourceTypes + "]"); } //******************************************************************************************** // Validate Message settings prior to invocation of vcs scripts //******************************************************************************************** // Check the VCS_MESSAGE_MANDATORY=true and determine whether the incoming message is null or empty and throw an exception. /* 3-7-2012: may not need String messageMandatory = vcsStruct.getVcsMessageMandatory(); if (messageMandatory.equalsIgnoreCase("true")) { if (vcsMessage == null || vcsMessage.length() == 0) { throw new ValidationException("The comment message may not be null or empty."); } } */ // Prepend the property VCS_MESSAGE_PREPEND to message String messagePrepend = vcsStruct.getVcsMessagePrepend(); if (messagePrepend != null && messagePrepend.length() > 0) { if (vcsMessage == null) { vcsMessage = messagePrepend; } else { vcsMessage = messagePrepend + " " + vcsMessage; } } // Validate the message is not null or emtpy if (vcsMessage == null || vcsMessage.length() == 0) { throw new ValidationException("VCS Message is null or empty."); } // Print out info statements CommonUtils.writeOutput("", prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput("---VCS Module ID Arguments:", prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" Resource Path =" + origResourcePath, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" Encoded Resource Path =" + vcsResourcePath, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" Resource Type =" + origResourceType, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" Converted Resource Type=" + vcsResourceType, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput(" Message =" + vcsMessage, prefix, "-debug2", logger, debug1, debug2, debug3); CommonUtils.writeOutput("", prefix, "-info", logger, debug1, debug2, debug3); CommonUtils.writeOutput("-- BEGIN OUTPUT ------------------------------------", prefix, "-info", logger, debug1, debug2, debug3); //-------------------------------------------------------------- // forced checkin //-------------------------------------------------------------- forced_checkin(vcsResourcePath, vcsResourceType, vcsMessage, vcsStruct, serverId, pathToServersXML); CommonUtils.writeOutput("", prefix, "-info", logger, debug1, debug2, debug3); CommonUtils.writeOutput("Successfully completed " + actionName + ".", prefix, "-info", logger, debug1, debug2, debug3); CommonUtils.writeOutput("", prefix, "-info", logger, debug1, debug2, debug3); } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.PrivilegeManagerImpl.java
public void generatePrivilegesXML(String serverId, String startPath, String pathToPrivilegeXML, String pathToServersXML, String filter, String options, String domainList) throws CompositeException { String prefix = "generatePrivilegesXML"; // Set the command and action name String command = "generatePrivilegesXML"; String actionName = "CREATE_XML"; // Validate whether the files exist or not if (!CommonUtils.fileExists(pathToServersXML)) { throw new CompositeException("File [" + pathToServersXML + "] does not exist."); }// w ww .j a v a 2s .c o m // Set the Module Action Objective String s1 = (startPath == null) ? "no_startPath" : "Path=" + startPath; System.setProperty("MODULE_ACTION_OBJECTIVE", "GENERATE : " + s1); String dependentFilter = null; try { boolean dependentResource = false; // If the filter is null or empty, then assume the user wants ALL resources if (filter == null || filter.trim().length() == 0) { filter = ""; for (ResourceType value : ResourceType.values()) { filter = filter + value.name() + ","; // Create a comma separated list of all valid ResourceTypes } filter = filter + "COLUMN"; dependentFilter = filter; } else // If the filter contains ALL then set the filter to all ResourceTypes including COLUMN if (filter.contains("ALL")) { filter = ""; for (ResourceType value : ResourceType.values()) { filter = filter + value.name() + ","; // Create a comma separated list of all valid ResourceTypes } filter = filter + "COLUMN"; dependentFilter = filter; } else // If the filters contains COLUMN make sure the dependent filter includes TABLE because TABLE resources contain the columns if (filter.contains("COLUMN")) { dependentResource = true; dependentFilter = filter + ",TABLE"; } else { // otherwise just set the dependent filter to the filter dependentFilter = filter; } // Prepare options for parsing if (options == null || options.trim().length() == 0) { options = ""; } else { options = options.trim(); } // Set Options for USER and GROUP boolean generateUser = false; boolean generateGroup = false; // Set Options for SYSTEM and NONSYSTEM boolean generateSystem = false; boolean generateNonSystem = false; // Set Options for PARENT and CHILD boolean generateParent = false; boolean generateChild = false; // Change space separators to comma separators options = options.replaceAll(" ", ","); StringTokenizer st = new StringTokenizer(options, ","); while (st.hasMoreTokens()) { String token = st.nextToken().trim().toUpperCase(); if (token.equalsIgnoreCase("USER")) { generateUser = true; } if (token.equalsIgnoreCase("GROUP")) { generateGroup = true; } if (token.equalsIgnoreCase("SYSTEM")) { generateSystem = true; } if (token.equalsIgnoreCase("NONSYSTEM")) { generateNonSystem = true; } if (token.equalsIgnoreCase("PARENT")) { generateParent = true; } if (token.equalsIgnoreCase("CHILD")) { generateChild = true; } } // If both USER and GROUP is not present then set the default to GROUP if (!generateUser && !generateGroup) { generateGroup = true; } // If both SYSTEM and NONSYSTEM is not present then set the default to NONSYSTEM if (!generateSystem && !generateNonSystem) { generateNonSystem = true; } // If both PARENT and CHILD is not present then set the default to PARENT if (!generateParent && !generateChild) { generateParent = true; } // Setup the domainList (default=composite) if (domainList == null || domainList.trim().length() == 0) { domainList = "composite"; } /*************************************** * * ResourceWSDAOImpl Invocation * ***************************************/ // Determine what type the current resourcePath is Resource currResourcePath = getResourceDAO().getResource(serverId, startPath, pathToServersXML); /*************************************** * * ResourceWSDAOImpl Invocation * ***************************************/ // Recursively walk the folder tree and get "ALL" resources by passing in null for resourceType ResourceList resourceList = new ResourceList(); resourceList .getResource().addAll( DeployManagerUtil.getDeployManager() .getResourcesFromPath(serverId, startPath, currResourcePath.getType().name(), dependentFilter, DetailLevel.FULL.name(), pathToServersXML) .getResource()); HashMap<String, String> resourceOwnerMap = new HashMap<String, String>(); if (resourceList != null && resourceList.getResource() != null && !resourceList.getResource().isEmpty()) { String privFilter = null; // only valid values are ALL_EXPLICIT and null boolean includeColumnPrivileges = false; // Generate a list of Entries from the getResourcesFromPath() // This list will be used go get the resource privileges list Entries entries = new Entries(); for (Resource resource : resourceList.getResource()) { String resourcePath = resource.getPath(); String resourceType = resource.getType().name(); String resourceOwner = null; String resourceOwnerDomain = null; if (resource.getOwnerName() != null) resourceOwner = resource.getOwnerName().toString(); if (resource.getOwnerDomain() != null) resourceOwnerDomain = resource.getOwnerDomain().toString(); // If the type of resource returned is a member of the filter list or the filter contains ALL then process that resource // Additionally, if the filter contains a COLUMN or TABLE then allow the dependency interrogation to pass through if (filter.contains(resourceType) || dependentResource) { // Only add the resource to the list if it is contained in the original filter if (filter.contains(resourceType)) { PathTypeOrColumnPair pathPair = new PathTypeOrColumnPair(); pathPair.setPath(resourcePath); pathPair.setType(ResourceOrColumnType.valueOf(resourceType)); entries.getEntry().add(pathPair); // Now add the resource owner and owner domain to a hashmap for later retrieval if (resourceOwner != null && resourceOwnerDomain != null) resourceOwnerMap.put(resourcePath + "::" + resourceType, resourceOwner + "::" + resourceOwnerDomain); else resourceOwnerMap.put(resourcePath + "::" + resourceType, null); } // If the current resource is of type TABLE and the filter contains COLUMN then process the columns if (resourceType.equalsIgnoreCase("TABLE") && filter.contains("COLUMN")) { TableResource tableResource = (TableResource) resource; // Loop over the list of columns ColumnList columns = tableResource.getColumns(); for (Column column : columns.getColumn()) { // Extract ColumnList from table String columnName = column.getName(); if (columnName.contains("/") || columnName.contains("\\")) { columnName = "\"" + columnName + "\""; } // Add a table resource PathTypeOrColumnPair pathPairColumn = new PathTypeOrColumnPair(); pathPairColumn.setPath(tableResource.getPath() + "/" + columnName); pathPairColumn.setType(ResourceOrColumnType.fromValue("COLUMN")); entries.getEntry().add(pathPairColumn); } } } } /*************************************** * * PrivilegeWSDAOImpl Invocation * ***************************************/ // Retrieve the Resource Privileges PrivilegeModule retPrivilegeModule = getPrivilegeDAO().getResourcePrivileges(entries, privFilter, includeColumnPrivileges, serverId, pathToServersXML); List<PrivilegeEntryType> privilegeEntries = retPrivilegeModule.getResourcePrivilege(); // Process OUT privilegeModule PrivilegeModule privilegeModule = new ObjectFactory().createPrivilegeModule(); int seq = 1; // Loop through the list of resource privileges for (PrivilegeEntryType retPrivs : privilegeEntries) { boolean processThisResourcePrivilege = false; if (generateParent && retPrivs.getResourcePath().equalsIgnoreCase(startPath)) { processThisResourcePrivilege = true; } if (generateChild && !retPrivs.getResourcePath().equalsIgnoreCase(startPath)) { processThisResourcePrivilege = true; } if (processThisResourcePrivilege) { PrivilegeEntryType resourcePrivilege = new PrivilegeEntryType(); resourcePrivilege.setId("priv" + seq++); String resourcePath = retPrivs.getResourcePath(); resourcePrivilege.setResourcePath(resourcePath); // Generate resourceType. Required to do this since COLUMN cannot be looked up by getAllResourcePaths // This is an optional element to maintain compatibility. String resourceType = null; if (retPrivs.getResourceType() != null) { resourceType = retPrivs.getResourceType().toString(); resourcePrivilege.setResourceType(ResourceTypeSimpleType.valueOf(resourceType)); } // Based on the results of the resourceOwner and resourceOwnerDomain, add them into the PrivilegeModule XML response. if (resourcePath != null && resourceType != null) { String resOwner = resourceOwnerMap.get(resourcePath + "::" + resourceType); String resourceOwnerName = null; String resourceOwnerDomain = null; // Split out the owner and domain from the result if (resOwner != null) { String[] resArry = resOwner.split("::", 2); resourceOwnerName = resArry[0]; resourceOwnerDomain = resArry[1]; } // Add the XML tags for "resourceOwner" and "resourceOwnerDomain" if (resourceOwnerName != null && resourceOwnerDomain != null) { ResourceOwnerType resourceOwner = new ResourceOwnerType(); // Set the resource ownership XML section resourceOwner.setResourceOwnerApply("true"); resourceOwner.setResourceOwnerName(resourceOwnerName); resourceOwner.setResourceOwnerDomain(resourceOwnerDomain); resourceOwner.setResourceOwnerRecurse("false"); resourcePrivilege.setResourceOwner(resourceOwner); } } // Set the recurse XML tag resourcePrivilege.setRecurse(true); //Loop through privileges List<PrivilegeType> retPrivList = retPrivs.getPrivilege(); for (PrivilegeType retPriv : retPrivList) { PrivilegeType privilege = new PrivilegeType(); // Get the privilege if domain, name, type and privilege are not null if (retPriv.getDomain() != null && retPriv.getName() != null && retPriv.getNameType() != null && retPriv.getPrivileges() != null) { boolean generatePrivilege = false; if (retPriv.getNameType().name().toString().equalsIgnoreCase("USER") && !doNotGenerateUsersList.contains(retPriv.getName().toLowerCase()) && generateUser) { generatePrivilege = true; } if (retPriv.getNameType().name().toString().equalsIgnoreCase("GROUP") && !doNotGenerateGroupsList.contains(retPriv.getName().toLowerCase()) && generateGroup) { generatePrivilege = true; } // Generate privilege is qualified by generateUser, generateGroup, doNotGenerateUsersList and doNotGenerateGroupsList if (generatePrivilege) { boolean generatePrivilegeQualified = false; if (generateSystem && generateNonSystem) { generatePrivilegeQualified = true; } else if (generateNonSystem) { if (retPriv.getNameType().name().toString().equalsIgnoreCase("USER") && !systemUserList.contains(retPriv.getName().toLowerCase())) { generatePrivilegeQualified = true; } if (retPriv.getNameType().name().toString().equalsIgnoreCase("GROUP") && !systemGroupList.contains(retPriv.getName().toLowerCase())) { generatePrivilegeQualified = true; } } else if (generateSystem) { if (retPriv.getNameType().name().toString().equalsIgnoreCase("USER") && systemUserList.contains(retPriv.getName().toLowerCase())) { generatePrivilegeQualified = true; } if (retPriv.getNameType().name().toString().equalsIgnoreCase("GROUP") && systemGroupList.contains(retPriv.getName().toLowerCase())) { generatePrivilegeQualified = true; } } // Generate privilege is qualified by generateSystem and generateNonSystem if (generatePrivilegeQualified) { // Finally, check that the domain is in the valid domainList before generating the privilege if (domainList.contains(retPriv.getDomain())) { // Set the Domain privilege.setDomain(retPriv.getDomain()); // Set the Name privilege.setName(retPriv.getName()); // Set the Name Type privilege.setNameType(PrivilegeNameTypeValidationList .valueOf(retPriv.getNameType().name())); // Set the Privileges privilege.getPrivileges().addAll(retPriv.getPrivileges()); // Set the Combined Privileges if it exists if (retPriv.getCombinedPrivileges() != null) { privilege.getCombinedPrivileges() .addAll(retPriv.getCombinedPrivileges()); } // Set the Inherited Privileges if it exists if (retPriv.getInheritedPrivileges() != null) { privilege.getInheritedPrivileges() .addAll(retPriv.getInheritedPrivileges()); } // Add the privilege node to the XML output resourcePrivilege.getPrivilege().add(privilege); } } } } } privilegeModule.getResourcePrivilege().add(resourcePrivilege); } } // Don't execute if -noop (NO_OPERATION) has been set otherwise execute under normal operation. if (CommonUtils.isExecOperation()) { XMLUtils.createXMLFromModuleType(privilegeModule, pathToPrivilegeXML); } else { logger.info("\n\nWARNING - NO_OPERATION: COMMAND [" + command + "], ACTION [" + actionName + "] WAS NOT PERFORMED.\n"); } /* // Retrieve the Resource Privileges privilegeEntries = getPrivilegeDAO().getResourcePrivileges(entries , privFilter, includeColumnPrivileges, serverId, pathToServersXML); PrivilegeModule privilegeModule = new ObjectFactory().createPrivilegeModule(); int seq=1; // Loop through the list of resource privileges for (PrivilegeEntry privs : privilegeEntries.getPrivilegeEntry()) { boolean processThisResourcePrivilege = false; if (generateParent && privs.getPath().equalsIgnoreCase(startPath)) { processThisResourcePrivilege = true; } if (generateChild && !privs.getPath().equalsIgnoreCase(startPath)) { processThisResourcePrivilege = true; } if (processThisResourcePrivilege) { PrivilegeEntryType resourcePrivilege = new PrivilegeEntryType(); resourcePrivilege.setId("priv"+seq++); resourcePrivilege.setResourcePath(privs.getPath()); // Generate resourceType. Required to do this since COLUMN cannot be looked up by getAllResourcePaths // This is an optional element to maintain compatibility. if (privs.getType() != null) { resourcePrivilege.setResourceType(ResourceTypeSimpleType.valueOf(privs.getType().toString())); } resourcePrivilege.setRecurse(true); //Loop through privileges for (Privilege priv : privs.getPrivileges().getPrivilege()) { PrivilegeType privilege = new PrivilegeType(); // Get the privilege if domain, name, type and privilege are not null if (priv.getDomain() != null && priv.getName() != null && priv.getNameType() != null && priv.getPrivs() != null) { boolean generatePrivilege = false; if (priv.getNameType().name().toString().equalsIgnoreCase("USER") && !doNotGenerateUsersList.contains(priv.getName().toLowerCase()) && generateUser) { generatePrivilege = true; } if (priv.getNameType().name().toString().equalsIgnoreCase("GROUP") && !doNotGenerateGroupsList.contains(priv.getName().toLowerCase()) && generateGroup) { generatePrivilege = true; } // Generate privilege is qualified by generateUser, generateGroup, doNotGenerateUsersList and doNotGenerateGroupsList if (generatePrivilege) { boolean generatePrivilegeQualified = false; if (generateSystem && generateNonSystem) { generatePrivilegeQualified = true; } else if (generateNonSystem) { if (priv.getNameType().name().toString().equalsIgnoreCase("USER") && !systemUserList.contains(priv.getName().toLowerCase())) { generatePrivilegeQualified = true; } if (priv.getNameType().name().toString().equalsIgnoreCase("GROUP") && !systemGroupList.contains(priv.getName().toLowerCase())) { generatePrivilegeQualified = true; } } else if (generateSystem) { if (priv.getNameType().name().toString().equalsIgnoreCase("USER") && systemUserList.contains(priv.getName().toLowerCase())) { generatePrivilegeQualified = true; } if (priv.getNameType().name().toString().equalsIgnoreCase("GROUP") && systemGroupList.contains(priv.getName().toLowerCase())) { generatePrivilegeQualified = true; } } // Generate privilege is qualified by generateSystem and generateNonSystem if (generatePrivilegeQualified) { // Finally, check that the domain is in the valid domainList before generating the privilege if (domainList.contains(priv.getDomain())) { // Set the Domain privilege.setDomain(priv.getDomain()); // Set the Name privilege.setName(priv.getName()); // Set the Name Type privilege.setNameType(PrivilegeNameTypeValidationList.valueOf(priv.getNameType().name())); // Set the Privileges // Tokenize a privilege list based on " " separator st = new StringTokenizer(priv.getPrivs(), " "); while (st.hasMoreTokens()) { String token = st.nextToken(); privilege.getPrivileges().add(PrivilegeValidationList.valueOf(token)); } // Set the Combined Privileges if it exists if (priv.getCombinedPrivs() != null) { // Tokenize a privilege list based on " " separator st = new StringTokenizer(priv.getCombinedPrivs(), " "); while (st.hasMoreTokens()) { String token = st.nextToken(); privilege.getCombinedPrivileges().add(PrivilegeValidationList.valueOf(token)); } } // Set the Inherited Privileges if it exists if (priv.getInheritedPrivs() != null) { // Tokenize a privilege list based on " " separator st = new StringTokenizer(priv.getInheritedPrivs(), " "); while (st.hasMoreTokens()) { String token = st.nextToken(); privilege.getInheritedPrivileges().add(PrivilegeValidationList.valueOf(token)); } } // Add the privilege node to the XML output resourcePrivilege.getPrivilege().add(privilege); } } } } } privilegeModule.getResourcePrivilege().add(resourcePrivilege); } } XMLUtils.createXMLFromModuleType(privilegeModule, pathToPrivilegeXML); */ } } catch (CompositeException e) { logger.error("Error generating PrivilegeModule XML: ", e); throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsForcedCheckin2(String serverId, String vcsConnectionId, String vcsResourcePath, String vcsResourceType, String vcsMessage, String pathToVcsXML, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsForcedCheckin2() with following params " + " serverName: " + serverId + " vcsConnectionId: " + vcsConnectionId + ", vcsResourcePath: " + vcsResourcePath + ", vcsMessage: " + vcsMessage + ", pathToServersXML: " + pathToServersXML); }//from w w w .jav a 2 s.co m try { // Set the VCS Module XML Connection Properties in the JVM Environment setVCSConnectionProperties(vcsConnectionId, pathToVcsXML); vcsConnId = vcsConnectionId; // Invoke the command vcsForcedCheckin(serverId, vcsResourcePath, vcsResourceType, vcsMessage, pathToServersXML, vcsUser, vcsPassword); } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsForcedCheckins(String serverId, String vcsIds, String pathToVcsXML, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsForcedCheckins() with following params " + " serverName: " + serverId + ", vcsIds: " + vcsIds + ", pathToVcsXML: " + pathToVcsXML + ", pathToServersXML: " + pathToServersXML);//from w w w . j a v a 2 s . c o m } try { // Set the global suppress and debug flags for this class based on properties found in the property file setGlobalProperties(); if (!vcsV2Method) vcsConnId = null; executeVCS(VCSManager.action.FORCED_CHECKIN.name(), serverId, vcsIds, pathToVcsXML, pathToServersXML, vcsUser, vcsPassword); } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }
From source file:com.cisco.dvbu.ps.deploytool.services.VCSManagerImpl.java
public void vcsForcedCheckins2(String serverId, String vcsConnectionId, String vcsIds, String pathToVcsXML, String pathToServersXML, String vcsUser, String vcsPassword) throws CompositeException { if (logger.isDebugEnabled()) { logger.debug("Entering VCSManagerImpl.vcsForcedCheckins2() with following params " + " serverName: " + serverId + " vcsConnectionId: " + vcsConnectionId + ", vcsIds: " + vcsIds + ", pathToVcsXML: " + pathToVcsXML + ", pathToServersXML: " + pathToServersXML); }/*from ww w . ja v a2s .c o m*/ try { // Set the VCS Module XML Connection Properties in the JVM Environment setVCSConnectionProperties(vcsConnectionId, pathToVcsXML); vcsConnId = vcsConnectionId; // Invoke the command vcsForcedCheckins(serverId, vcsIds, pathToVcsXML, pathToServersXML, vcsUser, vcsPassword); } catch (CompositeException e) { throw new ApplicationContextException(e.getMessage(), e); } }