Package org.wso2.carbon.application.deployer.config

Examples of org.wso2.carbon.application.deployer.config.RegistryConfig$Collection


    private void deployRegistryArtifacts(CarbonAppPersistenceManager capm,
                                         List<Artifact> artifacts, String parentAppName) {
        for (Artifact artifact : artifacts) {
            if (REGISTRY_RESOURCE_TYPE.equals(artifact.getType())) {
                try {
                    RegistryConfig regConfig = buildRegistryConfig(artifact);
                    if (regConfig != null) {
                        capm.writeArtifactResources(regConfig);
                        capm.persistRegConfig(AppDeployerConstants.APPLICATIONS +
                                parentAppName + AppDeployerConstants.APP_DEPENDENCIES +
                                artifact.getName(), regConfig);
View Full Code Here


     *
     * @param artifact - Registry/Resource artifact
     * @return - RegistryConfig instance
     */
    private RegistryConfig buildRegistryConfig(Artifact artifact) {
        RegistryConfig regConfig = null;
        // get the file path of the registry config file
        List<CappFile> files = artifact.getFiles();
        if (files.size() == 1) {
            String fileName = artifact.getFiles().get(0).getName();
            String regConfigPath = artifact.getExtractedPath() +
                    File.separator + fileName;

            File f = new File(regConfigPath);
            if (f.exists()) {
                // read the reg config file and build the configuration
                InputStream xmlInputStream = null;
                try {
                    xmlInputStream = new FileInputStream(f);
                    regConfig = AppDeployerUtils.populateRegistryConfig(
                            new StAXOMBuilder(xmlInputStream).getDocumentElement());
                } catch (Exception e) {
                    log.error("Error while reading file : " + fileName, e);
                } finally {
                    if (xmlInputStream != null) {
                        try {
                            xmlInputStream.close();
                        } catch (IOException e) {
                            log.error("Error while closing input stream.", e);
                        }
                    }
                }

                if (regConfig != null) {
                    regConfig.setExtractedPath(artifact.getExtractedPath());
                    regConfig.setParentArtifactName(artifact.getName());
                    regConfig.setConfigFileName(fileName);
                }
            } else {
                log.error("Registry config file not found at : " + regConfigPath);
            }
        } else {
View Full Code Here

     * @param artifactPath - registry path of the "registry/resource" artifact
     * @return - RegistryConfig instance built
     * @throws Exception - on registry errors
     */
    public RegistryConfig loadRegistryConfig(String artifactPath) throws Exception {
        RegistryConfig regConfig = null;
        String regConfigPath = artifactPath + AppDeployerConstants.REG_CONFIG_XML;
        if (configRegistry.resourceExists(regConfigPath)) {
            Resource artifactResource = configRegistry.get(regConfigPath);
            InputStream xmlStream = artifactResource.getContentStream();
            if (xmlStream != null) {
View Full Code Here

    public static RegistryConfig populateRegistryConfig(OMElement resourcesElement) {
        if (resourcesElement == null) {
            return null;
        }

        RegistryConfig regConfig = new RegistryConfig();

        // read Item elements under Resources
        Iterator itemItr = resourcesElement.getChildrenWithLocalName(RegistryConfig.ITEM);
        while (itemItr.hasNext()) {
            OMElement itemElement = (OMElement) itemItr.next();
            regConfig.addResource(readChildText(itemElement, RegistryConfig.PATH),
                    readChildText(itemElement, RegistryConfig.FILE),
                    readChildText(itemElement, RegistryConfig.REGISTRY_TYPE));
        }

        // read Collection elements under Resources
        Iterator collectionItr = resourcesElement.getChildrenWithLocalName(RegistryConfig.COLLECTION);
        while (collectionItr.hasNext()) {
            OMElement collElement = (OMElement) collectionItr.next();
            regConfig.addCollection(readChildText(collElement, RegistryConfig.PATH),
                    readChildText(collElement, RegistryConfig.DIRECTORY),
                    readChildText(collElement, RegistryConfig.REGISTRY_TYPE));
        }

        // read Association elements under Resources
        Iterator associationItr = resourcesElement.getChildrenWithLocalName(RegistryConfig.ASSOCIATION);
        while (associationItr.hasNext()) {
            OMElement assoElement = (OMElement) associationItr.next();
            regConfig.addAssociation(readChildText(assoElement, RegistryConfig.SOURCE_PATH),
                    readChildText(assoElement, RegistryConfig.TARGET_PATH),
                    readChildText(assoElement, RegistryConfig.TYPE),
                    readChildText(assoElement, RegistryConfig.REGISTRY_TYPE));
        }
        return regConfig;
View Full Code Here

    private void undeployRegistryArtifacts(CarbonAppPersistenceManager capm,
                                           List<Artifact> artifacts, String parentAppName) {
        for (Artifact artifact : artifacts) {
            if (RegistryResourceDeployer.REGISTRY_RESOURCE_TYPE.equals(artifact.getType())) {
                try {
                    RegistryConfig regConfig = artifact.getRegConfig();
                    if (regConfig == null) {
                        regConfig = capm.loadRegistryConfig(AppDeployerConstants.APPLICATIONS +
                                parentAppName + AppDeployerConstants.APP_DEPENDENCIES +
                                artifact.getName());
                    }
View Full Code Here

     * @return The end line number, or -1 if could not be determined
     */
    public int getEndLineNumber() {
      int ret=-1;
     
      ActivityInterface parent=getParent();
     
      if (parent != null) {
        int index=parent.getSubActivities().indexOf(this);
       
        if (index != -1) {
          if (index < (parent.getSubActivities().size()-1)) {
            ActivityInterface other=parent.getSubActivities().get(index+1);
           
            ret = other.getStartLineNumber()-1;
          } else {
            ret = parent.getEndLineNumber();
          }
        }
      }
View Full Code Here

     *
     * @param lineNumber The line number
     * @return The activity, or null if not found
     */
    public ActivityInterface getActivityAtLineNumber(int lineNumber) {
      ActivityInterface ret=null;
     
      int endline=getEndLineNumber();
     
      if (getStartLineNumber() <= lineNumber && (endline == -1 || endline >= lineNumber)) {
       
View Full Code Here

            int width = 0;
            int height = 0;
            dimensions = new SVGDimension(width, height);

            SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getWidth() > width) {
                    width += subActivityDim.getWidth();
                }
                height += subActivityDim.getHeight();
            }
View Full Code Here

    protected Element getArrows(SVGDocument doc) {
        Element subGroup = null;
        subGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");

        if (subActivities != null) {
            ActivityInterface prevActivity = null;
            ActivityInterface activity = null;
            String id = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates exitCoords = null;
            SVGCoordinates entryCoords = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = subActivities.iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                if (prevActivity != null) {
                    exitCoords = prevActivity.getExitArrowCoords();
                    entryCoords = activity.getEntryArrowCoords();
                    id = prevActivity.getId() + "-" + activity.getId();
                    subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                        exitCoords.getYTop(), entryCoords.getXLeft(),
                        entryCoords.getYTop(), id, prevActivity, activity));
                }
                prevActivity = activity;
View Full Code Here

    @Override
    public org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates getExitArrowCoords() {
        SVGCoordinates coords = getStartIconExitArrowCoords();

        if (subActivities != null && subActivities.size() > 0) {
            ActivityInterface activity = subActivities.get(subActivities.size() - 1);
            coords = activity.getExitArrowCoords();
        }
        return coords;
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.application.deployer.config.RegistryConfig$Collection

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.