Package org.apache.geronimo.kernel.repository

Examples of org.apache.geronimo.kernel.repository.Artifact


                patternSet = patterns.getPatterns();
            }

            for (AbstractNameQuery pattern : patternSet) {
                ReferenceType.Pattern patternType = new ReferenceType.Pattern();
                Artifact artifact = pattern.getArtifact();

                if (artifact != null) {
                    if (artifact.getGroupId() != null) {
                        patternType.setGroupId(artifact.getGroupId());
                    }
                    if (artifact.getArtifactId() != null) {
                        patternType.setArtifactId(artifact.getArtifactId());
                    }
                    if (artifact.getVersion() != null) {
                        patternType.setVersion(artifact.getVersion().toString());
                    }
                    if (artifact.getType() != null) {
                        patternType.setType(artifact.getType());
                    }
                }

                Map nameMap = pattern.getName();
                if (nameMap.get("module") != null) {
View Full Code Here


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String configId = request.getParameter("configId");
        if(configId == null) {
            throw new ServletException("No configId specified for CAR download");
        }
        Artifact artifact = Artifact.create(configId);
        Kernel kernel = KernelRegistry.getSingleKernel();
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
        try {
            response.setContentType("application/zip");
            String filename = artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType();
            response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filename, "UTF-8"));
            store.exportConfiguration(artifact, response.getOutputStream());
        } catch (NoSuchConfigException e) {
            throw new ServletException("No such configuration '"+configId+"'");
        }
View Full Code Here

        for (int i = 0; i < repos.length; i++) {
            ListableRepository repo = repos[i];
            final SortedSet artifacts = repo.list();
            outer:
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
              Artifact artifact = (Artifact)iterator.next();
                String test = artifact.toString();
                if (!test.endsWith("/rar")) { //todo: may need to change this logic if configId format changes
                    continue;
                } else if (repo.getLocation(artifact).isDirectory()) {
                  continue;
                }
View Full Code Here

    private LoginModule loadModule(PortletRequest request, RealmData data, Map options) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        ClassLoader loader = getClass().getClassLoader();
        if (data.jar != null && !data.jar.equals("")) {
            try {
                Artifact one = Artifact.create(data.getJar());
                ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
                for (int i = 0; i < repos.length; i++) {
                    ListableRepository repo = repos[i];
                    File file = repo.getLocation(one);
                    if (file != null) {
View Full Code Here

        parent.setArtifactId("j2ee-security");
        parent.setType("car");
        // Dependencies
        if (data.getJar() != null) {
            ArtifactType artifactType = dependenciesType.addNewDependency();
            Artifact artifact = Artifact.create(data.getJar());
            artifactType.setGroupId(artifact.getGroupId());
            artifactType.setArtifactId(artifact.getArtifactId());
            artifactType.setVersion(artifact.getVersion().toString());
            artifactType.setType(artifact.getType());
        }
        // Build the realm GBean
        GbeanType realm = GbeanType.Factory.newInstance();
        realm.setName(data.getName());
        realm.setClass1("org.apache.geronimo.security.realm.GenericSecurityRealm");
        AttributeType realmName = realm.addNewAttribute();
        realmName.setName("realmName");
        realmName.setStringValue(data.getName());
        ReferenceType serverInfo = realm.addNewReference();
        serverInfo.setName2("ServerInfo");
        serverInfo.setName((String) PortletManager.getNameFor(request, PortletManager.getCurrentServer(request).getServerInfo()).getName().get("name"));
        XmlAttributeType config = realm.addNewXmlReference();
        // Construct the content to put in the XmlAttributeType
        GerLoginConfigDocument lcDoc = GerLoginConfigDocument.Factory.newInstance();
        GerLoginConfigType login = lcDoc.addNewLoginConfig();
        for (int i = 0; i < data.getModules().length; i++) {
            LoginModuleDetails details = data.getModules()[i];
            if (details.getLoginDomainName() == null || details.getLoginDomainName().equals("")) {
                continue;
            }
            GerLoginModuleType module = login.addNewLoginModule();
            module.setControlFlag(details.getControlFlag().equals(LoginModuleControlFlag.OPTIONAL) ? GerControlFlagType.OPTIONAL :
                    details.getControlFlag().equals(LoginModuleControlFlag.REQUIRED) ? GerControlFlagType.REQUIRED :
                            details.getControlFlag().equals(LoginModuleControlFlag.REQUISITE) ? GerControlFlagType.REQUISITE :
                                    details.getControlFlag().equals(LoginModuleControlFlag.SUFFICIENT) ? GerControlFlagType.SUFFICIENT :
                                            GerControlFlagType.OPTIONAL);
            module.setLoginDomainName(details.getLoginDomainName());
            module.setLoginModuleClass(details.getClassName());
            module.setWrapPrincipals(details.isWrapPrincipals());
            for (Iterator it = details.getOptions().entrySet().iterator(); it.hasNext();) {
                Map.Entry entry = (Map.Entry) it.next();
                GerOptionType option = module.addNewOption();
                option.setName((String) entry.getKey());
                option.setStringValue((String) entry.getValue());
            }

            // bit of a hack -- to put the DataSource module in as a parent for SQL modules
            if (details.getClassName().indexOf("SQL") > -1) {
                String poolName = (String) details.getOptions().get("dataSourceName");
                String appName = (String) details.getOptions().get("dataSourceApplication");
                if (poolName != null) {
                    if (appName == null) appName = "null";
                    JCAManagedConnectionFactory[] factories = PortletManager.getOutboundFactoriesOfType(request, "javax.sql.DataSource");
                    for (int j = 0; j < factories.length; j++) {
                        JCAManagedConnectionFactory factory = factories[j];
                        try {
                            ObjectName objectName = ObjectName.getInstance(factory.getObjectName());
                            final String testName = objectName.getKeyProperty(NameFactory.J2EE_NAME);
                            final String testApp = objectName.getKeyProperty(NameFactory.J2EE_APPLICATION);
                            if (testName.equals(poolName) && testApp.equals(appName)) {
                                String moduleName = objectName.getKeyProperty(NameFactory.JCA_RESOURCE);

                                ArtifactType artifactType = dependenciesType.addNewDependency();
                                Artifact artifact = Artifact.create(moduleName);
                                artifactType.setGroupId(artifact.getGroupId());
                                artifactType.setArtifactId(artifact.getArtifactId());
                                artifactType.setVersion(artifact.getVersion().toString());
                                artifactType.setType(artifact.getType());
                                break;
                            }
                        } catch (MalformedObjectNameException e) {
                            log.error("Unable to parse ObjectName", e);
                        }
View Full Code Here

            ListableRepository repo = repos[i];

            SortedSet artifacts = repo.list();
            outer:
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
                Artifact artifact = (Artifact) iterator.next();
                String test = artifact.toString();
                // todo should only test groupId and should check for long (org.apache.geronimo) and short form
                for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
                    String skip = SKIP_ENTRIES_WITH[k];
                    if (test.indexOf(skip) > -1) {
                        continue outer;
View Full Code Here

        builder.addGBeans(earContext, module, cl, null);
        ConfigurationData configurationData = earContext.getConfigurationData();
        earContext.close();
        module.close();

        Artifact configurationId = configurationData.getId();
        configurationManager.loadConfiguration(configurationData);
        Configuration configuration = configurationManager.getConfiguration(configurationId);
        configurationManager.startConfiguration(configurationId);

        return new WebModuleInfo(moduleName, configuration);
View Full Code Here

        }
        return delegate.containsConfiguration(configId);
    }

    public File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException {
        Artifact slaveConfigId = slaveConfigNameBuilder.buildSlaveConfigurationName(configId);
        return delegate.createNewConfigurationDir(slaveConfigId);
    }
View Full Code Here

        return delegate.getObjectName();
    }

    public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
        Environment environment = configurationData.getEnvironment();
        Artifact actualConfigId = environment.getConfigId();
        Artifact slaveConfigId = slaveConfigNameBuilder.buildSlaveConfigurationName(actualConfigId);
        environment.setConfigId(slaveConfigId);

        storeDelegate.install(clusterInfo, configurationData);
        installSlaveConfiguration(configurationData);
View Full Code Here

    }

    public void uninstall(Artifact configId) throws NoSuchConfigException, IOException {
        ensureArtifactForMasterConfiguration(configId);
       
        Artifact slaveConfigId = slaveConfigNameBuilder.buildSlaveConfigurationName(configId);
        storeDelegate.uninstall(clusterInfo, slaveConfigId);

        try {
            delegate.uninstall(slaveConfigId);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.repository.Artifact

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.