Package org.osgi.service.deploymentadmin

Examples of org.osgi.service.deploymentadmin.DeploymentException


    private void verifyEntryName(String name) throws DeploymentException {
        byte[] bytes = name.getBytes();
        boolean delimiterSeen = false;
        for(int j = 0; j < bytes.length; j++) {
            if(!VALID_RESOURCE_PATH_CHARS.get(bytes[j])) {
                throw new DeploymentException(DeploymentException.CODE_BAD_HEADER, "Resource ID '" + name +"' contains invalid character(s)");
            }
            if (bytes[j] == '/') {
                if (delimiterSeen) {
                    throw new DeploymentException(DeploymentException.CODE_BAD_HEADER, "Resource ID '" + name +"' contains multiple consequetive path seperators");
                } else {
                    delimiterSeen = true;
                }
            } else {
                delimiterSeen = false;
View Full Code Here


            if ("true".equals(value)) {
                return true;
            } else if ("false".equals(value)){
                return false;
            } else {
                throw new DeploymentException(DeploymentException.CODE_BAD_HEADER, "Invalid '" + header + "' header for manifest " +
                    "entry '" + getPath() + "' header, should be either 'true' or 'false' or not present");
            }
        }
        return false;
    }
View Full Code Here

        for (int i = 0; i < m_bundleInfos.length; i++) {
            String bsn = m_bundleInfos[i].getSymbolicName();
            if (m_nameToBundleInfo.put(bsn, m_bundleInfos[i]) != null) {
                // FELIX-4463: make sure that the DP is consistent...
                throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Duplicate bundle present in deployment package: " + bsn);
            }

            String path = m_bundleInfos[i].getPath();
            if (m_pathToEntry.put(path, m_bundleInfos[i]) != null) {
                // FELIX-4463: make sure that the DP is consistent...
                throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Non-unique path present in deployment package: " + path);
            }
        }

        List resourceInfos = m_manifest.getResourceInfos();
        m_resourceInfos = (ResourceInfoImpl[]) resourceInfos.toArray(new ResourceInfoImpl[resourceInfos.size()]);

        for (int i = 0; i < m_resourceInfos.length; i++) {
            String path = m_resourceInfos[i].getPath();
            if (m_pathToEntry.put(path, m_resourceInfos[i]) != null) {
                // FELIX-4463: make sure that the DP is consistent...
                throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Non-unique path present in deployment package: " + path);
            }
        }
        m_resourcePaths = (String[]) m_pathToEntry.keySet().toArray(new String[m_pathToEntry.size()]);
    }
View Full Code Here

    public BundleInfoImpl(String path, Attributes attributes) throws DeploymentException {
        super(path, attributes);

        String bundleSymbolicName = attributes.getValue(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME);
        if (bundleSymbolicName == null) {
            throw new DeploymentException(DeploymentException.CODE_MISSING_HEADER, "Missing '" + org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME + "' header for manifest entry '" + getPath() + "'");
        } else if (bundleSymbolicName.trim().equals("")) {
            throw new DeploymentException(DeploymentException.CODE_BAD_HEADER, "Invalid '" + org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME + "' header for manifest entry '" + getPath() + "'");
        } else {
            m_symbolicName = parseSymbolicName(bundleSymbolicName);
        }

        String version = attributes.getValue(org.osgi.framework.Constants.BUNDLE_VERSION);
        if (version == null || version == "") {
            throw new DeploymentException(DeploymentException.CODE_BAD_HEADER, "Invalid '" + org.osgi.framework.Constants.BUNDLE_VERSION + "' header for manifest entry '" + getPath() + "'");
        }
        try {
            m_version = Version.parseVersion(version);
        } catch (IllegalArgumentException e) {
            throw new DeploymentException(DeploymentException.CODE_BAD_HEADER, "Invalid '" + org.osgi.framework.Constants.BUNDLE_VERSION + "' header for manifest entry '" + getPath() + "'");
        }

        m_customizer = parseBooleanHeader(attributes, Constants.DEPLOYMENTPACKAGE_CUSTOMIZER);
    }
View Full Code Here

TOP

Related Classes of org.osgi.service.deploymentadmin.DeploymentException

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.