|
Glassfish example source code file (RuntimeRootImpl.java)
This example Glassfish source code file (RuntimeRootImpl.java) is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.
The Glassfish RuntimeRootImpl.java source code
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.admin.amx.impl.ext;
import java.util.List;
import javax.management.ObjectName;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.logging.Level;
import com.sun.enterprise.module.ModulesRegistry;
import com.sun.enterprise.module.Module;
import com.sun.enterprise.security.ssl.SSLUtils;
import javax.management.JMException;
import javax.management.remote.JMXServiceURL;
import org.glassfish.admin.amx.base.RuntimeRoot;
import org.glassfish.admin.amx.base.ServerRuntime;
import org.glassfish.admin.amx.impl.mbean.AMXImplBase;
import org.glassfish.admin.amx.impl.util.ImplUtil;
import org.glassfish.admin.amx.intf.config.Domain;
import org.glassfish.admin.amx.intf.config.grizzly.NetworkConfig;
import org.glassfish.admin.amx.intf.config.grizzly.NetworkListener;
import org.glassfish.admin.amx.intf.config.grizzly.NetworkListeners;
import org.glassfish.admin.amx.intf.config.grizzly.Protocol;
import org.glassfish.admin.amx.util.ExceptionUtil;
import org.glassfish.api.container.Sniffer;
import org.glassfish.internal.data.ApplicationInfo;
import org.glassfish.internal.data.ModuleInfo;
import org.glassfish.internal.data.EngineRef;
import org.glassfish.internal.data.ApplicationRegistry;
import org.glassfish.api.deployment.archive.ReadableArchive;
import org.jvnet.hk2.component.Habitat;
import org.glassfish.admin.amx.impl.util.InjectedValues;
import org.glassfish.external.amx.AMXGlassfish;
import org.glassfish.api.admin.AdminCommandContext;
import com.sun.enterprise.v3.admin.RestartDomainCommand;
import com.sun.enterprise.v3.common.PlainTextActionReporter;
import org.glassfish.api.admin.AdminCommand;
import com.sun.enterprise.v3.admin.commands.JVMInformation;
import com.sun.enterprise.deployment.Application;
import com.sun.enterprise.deployment.BundleDescriptor;
import com.sun.enterprise.deployment.WebBundleDescriptor;
import com.sun.enterprise.deployment.EjbBundleDescriptor;
import com.sun.enterprise.deployment.EjbDescriptor;
import com.sun.enterprise.deployment.EjbSessionDescriptor;
import com.sun.enterprise.deployment.EjbEntityDescriptor;
import com.sun.enterprise.deployment.EjbMessageBeanDescriptor;
import com.sun.enterprise.deployment.WebComponentDescriptor;
import javax.management.MBeanServer;
import org.glassfish.admin.amx.impl.util.ObjectNameBuilder;
import org.glassfish.admin.amx.util.StringUtil;
/**
AMX RealmsMgr implementation.
Note that realms don't load until {@link #loadRealms} is called.
*/
public final class RuntimeRootImpl extends AMXImplBase
// implements RuntimeRoot
{
private final ApplicationRegistry appRegistry;
private final Habitat mHabitat;
public RuntimeRootImpl(final ObjectName parent)
{
super(parent, RuntimeRoot.class);
mHabitat = InjectedValues.getInstance().getHabitat();
appRegistry = mHabitat.getComponent(ApplicationRegistry.class);
}
public ObjectName[] getServerRuntime()
{
return getChildren( ServerRuntime.class );
}
@Override
protected final void
registerChildren()
{
super.registerChildren();
final ObjectName self = getObjectName();
final MBeanServer server = getMBeanServer();
final ObjectNameBuilder objectNames = new ObjectNameBuilder( server, self );
ObjectName childObjectName = null;
Object mbean = null;
// when clustering comes along, some other party will need to register MBeans
// for each non-DAS instance
childObjectName = objectNames.buildChildObjectName( ServerRuntime.class, AMXGlassfish.DEFAULT.dasName() );
mbean = new ServerRuntimeImpl(self);
registerChild( mbean, childObjectName );
}
/**
* Return a list of deployment descriptor maps for the specified
* application.
* In each map:
* a. The module name is stored by the MODULE_NAME_KEY.
* b. The path of the deployment descriptor is stored by the DD_PATH_KEY.
* c. The content of the deployment descriptor is stored by the
* DD_CONTENT_KEY.
* @param the application name
* @return the list of deployment descriptor maps
*
*/
public List<Map getDeploymentConfigurations(final String appName)
{
final ApplicationInfo appInfo = appRegistry.get(appName);
final List<Map resultList = new ArrayList
Other Glassfish examples (source code examples)
Here is a short list of links related to this Glassfish RuntimeRootImpl.java source code file:
|