/** * Obtain the Deployment Manager * @throws Exception */ protected void initDeploymentManager() throws Exception { String profileName = "default"; InitialContext ctx = new InitialContext(); ProfileService ps = (ProfileService) ctx.lookup("ProfileService"); deploymentManager = ps.getDeploymentManager(); ProfileKey defaultKey = new ProfileKey(profileName); deploymentManager.loadProfile(defaultKey); }
private synchronized void activateProfile(boolean validate) throws Exception { if (this.profileService == null) { throw new IllegalStateException("Must configure the ProfileService"); } ProfileKey profKey = getProfileKey(); if (this.profileService.getActiveProfileKeys().contains(profKey) == false) { this.profileService.activateProfile(profKey); if (validate) { // Validate if the activation was successful this.profileService.validateProfile(profKey); } this.activated = true; } else { log.warn("Profile " + profKey + " is already activated"); this.activated = true; } }
/** * stop() * * @throws Exception */ public void stop() throws Exception { this.ps.deactivateProfile(TRANSIENT_PROFILE_KEY); this.ps.unregisterProfile(TRANSIENT_PROFILE_KEY); }
/** * start() * * @throws Exception */ public void start() throws Exception { Profile profile = new TransientDeploymentsProfile(); TRANSIENT_PROFILE_KEY = this.ps.registerProfile(new EmptyProfileMetaData(TRANSIENT_PROFILE_KEY.getName()), profile); this.ps.activateProfile(TRANSIENT_PROFILE_KEY); this.ps.validateProfile(TRANSIENT_PROFILE_KEY); }
if (profileService.getActiveProfileKeys().contains(profKey)) profileService.unregisterProfile(profKey);
/** * {@inheritDoc} */ public synchronized void activateProfile() throws Exception { if (this.profileService == null) { throw new IllegalStateException("Must configure the ProfileService"); } if (!this.activated) { try { this.profileService.activateProfile(getProfileKey()); // Validate if the activation was successful this.profileService.validateProfile(getProfileKey()); this.activated = true; } catch (NoSuchProfileException e) { handleNoSuchProfileException(e); } } }
@Override public void init(ServletConfig config) throws ServletException { super.init(config); if(mgtView == null) { if(ps == null) { try { InitialContext ctx = new InitialContext(); ps = (ProfileService) ctx.lookup("ProfileService"); } catch (NamingException e) { throw new ServletException("Failed to lookup java:ProfileService", e); } } this.mgtView = ps.getViewManager(); } }
this.profileKey = this.profileService.registerProfile(profileMetaData);
/** * Tells the ProfileService to {@link ProfileService#releaseProfile(ProfileKey) release the profile}. * Called by the HASingletonController when we are no longer the singleton master. */ private synchronized void releaseProfile() throws Exception { if (this.activated) { try { this.profileService.deactivateProfile(getProfileKey()); } catch (NoSuchProfileException e) { log.warn("No Profile is registered under key " + getProfileKey()); } this.activated = false; } }
/** * Unregisters the profile registered in {@link #start()}. */ public void stop() throws Exception { ProfileService profSvc = getProfileService(); ProfileKey profKey = getProfileKey(); if (profSvc != null && profKey != null) { try { // Inactivate first if needed if (profSvc.getActiveProfileKeys().contains(profKey)) { releaseProfile(); } profSvc.unregisterProfile(profKey); } catch (NoSuchProfileException e) { log.warn("Could not unregister unknown profile " + profKey); } } }
public static ProtocolMetaData parse(String archiveName, ProfileService profile) throws Exception { ProtocolMetaData metaData = new ProtocolMetaData(); ManagementView management = profile.getViewManager(); management.load(); // extract server info HTTPContext httpContext = extractHTTPContext(management); if (httpContext != null) { metaData.addContext(httpContext); } // extract deployment content scanDeployment(management, httpContext, management.getDeployment(archiveName)); return metaData; }
deploymentRoot, this.deploymentNames.toArray(new String[this.deploymentNames.size()])); this.profileKey = this.profileService.registerProfile(metadata);
/** * Tells the ProfileService to {@link ProfileService#releaseProfile(ProfileKey) release the profile}. * */ private synchronized void releaseProfile() throws Exception { if (this.activated) { try { this.profileService.deactivateProfile(getProfileKey()); } catch (NoSuchProfileException e) { log.warn("Can't deactivate profile since no Profile is registered under key " + getProfileKey()); } this.activated = false; } }
private void initDeploymentManager() throws Exception { Context ctx = createContext(); profileService = (ProfileService) ctx.lookup("ProfileService"); deploymentManager = profileService.getDeploymentManager(); ProfileKey defaultKey = new ProfileKey(DEFAULT_PROFILE_KEY_NAME); deploymentManager.loadProfile(defaultKey); }
if (this.profileService.getActiveProfileKeys().contains(profKey) == false) this.profileService.activateProfile(profKey); this.profileService.validateProfile(profKey);
if (profileService.getActiveProfileKeys().contains(profKey)) profileService.unregisterProfile(profKey);
public static ProtocolMetaData parse(String archiveName, ProfileService profile) throws Exception { ProtocolMetaData metaData = new ProtocolMetaData(); ManagementView management = profile.getViewManager(); management.load(); // extract server info HTTPContext httpContext = extractHTTPContext(management); if (httpContext != null) { metaData.addContext(httpContext); } // extract deployment content scanDeployment(management, httpContext, management.getDeployment(archiveName)); return metaData; }
/** * Builds a profile from the {@link #getURIList() URI list} and registers * it under the configured {@link #getProfileKey()}. */ public void start() throws Exception { if (getProfileService() == null) { throw new IllegalStateException("Must configure profileService"); } // TODO add dependencies on bootstrap profiles String[] rootSubProfiles = new String[0]; // Create a hotdeployment profile ProfileMetaData metadata = createProfileMetaData(true, deployURI, rootSubProfiles); setProfileKey(getProfileService().registerProfile(metadata)); }
/** * {@inheritDoc} */ public synchronized void releaseProfile() throws Exception { if (this.activated) { try { this.profileService.deactivateProfile(getProfileKey()); } catch (NoSuchProfileException e) { log.warn("No Profile is registered under key " + getProfileKey()); } this.activated = false; } }
private void initDeploymentManager() throws Exception { String profileName = configuration.getProfileName(); InitialContext ctx = new InitialContext(); ProfileService ps = (ProfileService) ctx.lookup("ProfileService"); deploymentManager = ps.getDeploymentManager(); ProfileKey defaultKey = new ProfileKey(profileName); deploymentManager.loadProfile(defaultKey); VFS.init(); }