Search in sources :

Example 6 with Domain

use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.

the class GeneratorResource method get.

@GET
@Produces({ "text/plain" })
public String get(@QueryParam("outputDir") String outputDir) {
    if (outputDir == null) {
        outputDir = DEFAULT_OUTPUT_DIR;
    }
    String retVal = "Code Generation done at : " + outputDir;
    try {
        LocatorBridge locatorBridge = habitat.getService(LocatorBridge.class);
        Dom dom = Dom.unwrap(locatorBridge.getRemoteLocator().<Domain>getService(Domain.class));
        DomDocument document = dom.document;
        ConfigModel rootModel = dom.document.getRoot().model;
        ResourcesGenerator resourcesGenerator = new TextResourcesGenerator(outputDir, habitat);
        resourcesGenerator.generateSingle(rootModel, document);
        resourcesGenerator.endGeneration();
    } catch (Exception ex) {
        RestLogging.restLogger.log(Level.SEVERE, null, ex);
        retVal = "Exception encountered during generation process: " + ex.toString() + "\nPlease look at server.log for more information.";
    }
    return retVal;
}
Also used : Dom(org.jvnet.hk2.config.Dom) ConfigModel(org.jvnet.hk2.config.ConfigModel) ResourcesGenerator(org.glassfish.admin.rest.generator.ResourcesGenerator) TextResourcesGenerator(org.glassfish.admin.rest.generator.TextResourcesGenerator) TextResourcesGenerator(org.glassfish.admin.rest.generator.TextResourcesGenerator) LocatorBridge(org.glassfish.admin.rest.adapter.LocatorBridge) Domain(com.sun.enterprise.config.serverbeans.Domain) DomDocument(org.jvnet.hk2.config.DomDocument) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 7 with Domain

use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.

the class UniqueResourceNameValidator method initialize.

@Override
public void initialize(final UniqueResourceNameConstraint constraint) {
    ServiceLocator habitat = Globals.getDefaultHabitat();
    // due to: http://java.net/jira/browse/GLASSFISH-19043
    if (habitat == null)
        return;
    domain = habitat.getService(Domain.class);
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) Domain(com.sun.enterprise.config.serverbeans.Domain)

Example 8 with Domain

use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.

the class DomainTest method domainExist.

@Test
public void domainExist() {
    Domain domain = getHabitat().getService(Domain.class);
    assertTrue(domain != null);
}
Also used : Domain(com.sun.enterprise.config.serverbeans.Domain) Test(org.junit.Test)

Example 9 with Domain

use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.

the class DGTest method testThereAreTwo.

@Test
public void testThereAreTwo() {
    Domain d = habitat.getService(Domain.class);
    DeploymentGroups dgs = d.getDeploymentGroups();
    assertNotNull("Deployment Groups should not be null", dgs);
    List<DeploymentGroup> ldg = dgs.getDeploymentGroup();
    assertNotNull("Deployment Groups List should not be null", ldg);
    assertEquals("List should have 2 deployment groups", 2L, ldg.size());
}
Also used : DeploymentGroups(fish.payara.enterprise.config.serverbeans.DeploymentGroups) Domain(com.sun.enterprise.config.serverbeans.Domain) DeploymentGroup(fish.payara.enterprise.config.serverbeans.DeploymentGroup) ConfigApiTest(com.sun.enterprise.configapi.tests.ConfigApiTest) Test(org.junit.Test)

Example 10 with Domain

use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.

the class DGTest method getDeploymentGroupFromServerTest.

@Test
public void getDeploymentGroupFromServerTest() {
    Domain d = habitat.getService(Domain.class);
    Server server = d.getServerNamed("server2");
    assertTrue(server != null);
    List<DeploymentGroup> dgs = server.getDeploymentGroup();
    assertEquals("List should have 1 element", 1L, dgs.size());
}
Also used : Server(com.sun.enterprise.config.serverbeans.Server) Domain(com.sun.enterprise.config.serverbeans.Domain) DeploymentGroup(fish.payara.enterprise.config.serverbeans.DeploymentGroup) ConfigApiTest(com.sun.enterprise.configapi.tests.ConfigApiTest) Test(org.junit.Test)

Aggregations

Domain (com.sun.enterprise.config.serverbeans.Domain)70 Test (org.junit.Test)21 Server (com.sun.enterprise.config.serverbeans.Server)15 ConfigApiTest (com.sun.enterprise.configapi.tests.ConfigApiTest)12 Dom (org.jvnet.hk2.config.Dom)11 PropertyVetoException (java.beans.PropertyVetoException)10 Cluster (com.sun.enterprise.config.serverbeans.Cluster)7 Resources (com.sun.enterprise.config.serverbeans.Resources)7 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)7 ServerContext (org.glassfish.internal.api.ServerContext)7 Config (com.sun.enterprise.config.serverbeans.Config)6 Resource (com.sun.enterprise.config.serverbeans.Resource)6 ParameterMap (org.glassfish.api.admin.ParameterMap)6 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)6 DeploymentGroup (fish.payara.enterprise.config.serverbeans.DeploymentGroup)5 HashMap (java.util.HashMap)5 Map (java.util.Map)5 Before (org.junit.Before)5 ConfigModel (org.jvnet.hk2.config.ConfigModel)5 PropsFileActionReporter (com.sun.enterprise.admin.report.PropsFileActionReporter)4