Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.ConfigBean


        final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class);
        Transaction t = new Transaction();

        try {
            // prepare the application element
            ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class);
            Application app = newBean.createProxy();
            Application app_w = t.enroll(app);
            setInitialAppAttributes(app_w, deployParams, appProps, context);
            context.addTransientAppMetaData(ServerTags.APPLICATION, app_w);
        } catch(TransactionFailure e) {
            t.rollback();
View Full Code Here


            return handleError(Status.FORBIDDEN, message);
        }

        if (getDeleteCommand().equals("GENERIC-DELETE")) {
            try {
                ConfigBean p = (ConfigBean) parent;
                if (parent == null) {
                    p = (ConfigBean) entity.parent();
                }
                ConfigSupport.deleteChild(p, (ConfigBean) entity);
                return Response.ok(ResourceUtil.getActionReportResult(ActionReport.ExitCode.SUCCESS,
View Full Code Here

    }

    protected ActionReportResult buildActionReportResult(boolean showEntityValues) {
        RestActionReporter ar = new RestActionReporter();
        ar.setExtraProperties(new Properties());
        ConfigBean entity = (ConfigBean) getEntity();
        if (childID != null) {
            ar.setActionDescription(childID);

        } else if (childModel != null) {
            ar.setActionDescription(childModel.getTagName());
View Full Code Here

            final Map<String, String> childResources = (Map<String, String>) ar.getExtraProperties().get("childResources");
            final List<Map<String, String>> commands = (List<Map<String, String>>) ar.getExtraProperties().get("commands");
            final MethodMetaData postMetaData = proxy.getMetaData().getMethodMetaData("POST");
            final MethodMetaData deleteMetaData = proxy.getMetaData().getMethodMetaData("DELETE");
            final MethodMetaData getMetaData = proxy.getMetaData().getMethodMetaData("GET");
            final ConfigBean entity = proxy.getEntity();

            if ((proxy.getCommandDisplayName()!=null) &&(getMetaData!=null)) {//for commands, we want the output of the command before the form
                if (entity==null) {//show extra properties only for non entity pages
                    result.append(processReport(ar));
                }
View Full Code Here

        final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class);
        Transaction t = new Transaction();

        try {
            // prepare the application element
            ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class);
            Application app = newBean.createProxy();
            Application app_w = t.enroll(app);
            setInitialAppAttributes(app_w, deployParams, appProps, context);
            context.addTransientAppMetaData(ServerTags.APPLICATION, app_w);
        } catch(TransactionFailure e) {
            t.rollback();
View Full Code Here

                StringTokenizer st = new StringTokenizer(values, ",");
                List<String> valList = new ArrayList<String>();
                while (st.hasMoreTokens()) valList.add(st.nextToken());

                ConfigBean bean = writeableParent.getMasterView();
                for (Method m : writeableParent.getProxyType().getMethods()) {
                    // Check to see if the method is a setter for the element
                    // An element setter has to have the right name, take a single
                    // collection parameter that parameterized with the right type
                    Class argClasses[] = m.getParameterTypes();
View Full Code Here

            return handleError(Status.FORBIDDEN, message);
        }

        if (getDeleteCommand().equals("GENERIC-DELETE")) {
            try {
                ConfigBean p = (ConfigBean) parent;
                if (parent == null) {
                    p = (ConfigBean) entity.parent();
                }
                ConfigSupport.deleteChild(p, (ConfigBean) entity);
                return Response.ok(ResourceUtil.getActionReportResult(ActionReport.ExitCode.SUCCESS,
View Full Code Here

    }

    protected ActionReportResult buildActionReportResult(boolean showEntityValues) {
        RestActionReporter ar = new RestActionReporter();
        ar.setExtraProperties(new Properties());
        ConfigBean entity = (ConfigBean) getEntity();
        if (childID != null) {
            ar.setActionDescription(childID);

        } else if (childModel != null) {
            ar.setActionDescription(childModel.getTagName());
View Full Code Here

            final Map<String, String> childResources = (Map<String, String>) ar.getExtraProperties().get("childResources");
            final List<Map<String, String>> commands = (List<Map<String, String>>) ar.getExtraProperties().get("commands");
            final MethodMetaData postMetaData = proxy.getMetaData().getMethodMetaData("POST");
            final MethodMetaData deleteMetaData = proxy.getMetaData().getMethodMetaData("DELETE");
            final MethodMetaData getMetaData = proxy.getMetaData().getMethodMetaData("GET");
            final ConfigBean entity = proxy.getEntity();

            if ((proxy.getCommandDisplayName()!=null) &&(getMetaData!=null)) {//for commands, we want the output of the command before the form
                if (entity==null) {//show extra properties only for non entity pages
                    result.append(processReport(ar));
                }
View Full Code Here

    Also, there can be a Name attribute which is not a key value.
     */
    @Override
    public String getName()
    {
        final ConfigBean cb = getConfigBean();

        String name = AMXConfigLoader.getKey(cb);
        if ( name == null )
        {
            // deal with annoying and rare case of name existing, but not a key value
            name = cb.rawAttribute( "name" );
        }
       
        return name == null ? NO_NAME : name;
    }
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.config.ConfigBean

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.