public ProfileKey getProfileKey() { return new ProfileKey(profileDomain, profileServer, profileName); }
@Override public MetaValue createMetaValue(MetaType metaType, ProfileKey key) { if(key == null) { throw new IllegalArgumentException("null profile key"); } return SimpleValueSupport.wrap(key.getName()); }
public boolean equals(Object o) { if(o == this) return true; if(o instanceof ProfileKey) return compareTo(ProfileKey.class.cast(o)) == 0; return false; }
@Override public void notify(final ModificationEvent event) { // TODO this should be more fine grained if(event.getModificationType() != ProfileModificationType.GET && getKey().equals(event.getKey())) { markAsModified(); } }
public String toString() { StringBuilder tmp = new StringBuilder(); tmp.append(getClass().getSimpleName()); tmp.append('@').append(Integer.toHexString(System.identityHashCode(this))); tmp.append('['); tmp.append("domain="); tmp.append(getDomain()); tmp.append(", server="); tmp.append(getServer()); tmp.append(", name="); tmp.append(getName()); tmp.append(']'); return tmp.toString(); }
/** * 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); }
@Override public MetaValue createMetaValue(MetaType metaType, ProfileKey key) { if(key == null) { throw new IllegalArgumentException("null profile key"); } return SimpleValueSupport.wrap(key.getName()); }
@Override public ProfileKey unwrapMetaValue(MetaValue metaValue) { if(metaValue != null && SimpleMetaType.STRING.equals(metaValue.getMetaType())) { String profileName = String.class.cast(((SimpleValue) metaValue).getValue()); return new ProfileKey(profileName); } throw new IllegalStateException("cannot recreate 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); }
@Override public ProfileKey unwrapMetaValue(MetaValue metaValue) { if(metaValue != null && SimpleMetaType.STRING.equals(metaValue.getMetaType())) { String profileName = String.class.cast(((SimpleValue) metaValue).getValue()); return new ProfileKey(profileName); } throw new IllegalStateException("cannot recreate profile key"); }
/** * Start a set of deployments. * * @param deploymentNames the deployment names * @throws Exception for any error */ protected void startDeployments(String... deploymentNames) throws Exception { Map<ProfileKey, Set<String>> mappings = resolveProfiles(deploymentNames, false, true); BasicProfileModificationRequest actions = new BasicProfileModificationRequest(ProfileModificationType.UPDATE); for(ProfileKey key : mappings.keySet()) { ManagedProfile managed = actionController.getManagedProfile(key); if(managed == null) { throw new NoSuchProfileException(key.getName()); } actions.addAction(key, new DeploymentStartAction(managed, mappings.get(key), null)); } checkStatus(actionController.perform(actions)); }
/** * @return JBoss profile for the {@link Configuration}. */ private ProfileKey getProfile() { String server = this.configuration.getPropertyValue(JBossPropertySet.CONFIGURATION); if (server == null || server.trim().isEmpty()) { server = ProfileKey.DEFAULT; } String profile = this.configuration.getPropertyValue(JBossPropertySet.PROFILE); boolean isClustered = Boolean.parseBoolean(this.configuration.getPropertyValue( JBossPropertySet.CLUSTERED)); String name = isClustered ? "farm" : profile; if (name == null || name.trim().isEmpty()) { name = ProfileKey.DEFAULT; } return new ProfileKey(ProfileKey.DEFAULT, server, name); }
/** * Stop a set of deployments. * * @param deploymentNames the deployment names * @throws Exception for any error */ protected void stopDeployments(String... deploymentNames) throws Exception { Map<ProfileKey, Set<String>> mappings = resolveProfiles(deploymentNames, false, true); BasicProfileModificationRequest actions = new BasicProfileModificationRequest(ProfileModificationType.UPDATE); for(ProfileKey key : mappings.keySet()) { ManagedProfile managed = actionController.getManagedProfile(key); if(managed == null) { throw new NoSuchProfileException(key.getName()); } actions.addAction(key, new DeploymentStopAction(managed, mappings.get(key), null)); } checkStatus(actionController.perform(actions)); }
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); }
/** * Remove a set of deployments. * * @param deploymentNames the deployment names * @throws Exception for any error */ protected void removeDeployments(String... deploymentNames) throws Exception { Map<ProfileKey, Set<String>> mappings = resolveProfiles(deploymentNames, true, true); BasicProfileModificationRequest actions = new BasicProfileModificationRequest(ProfileModificationType.DELETE); for(ProfileKey key : mappings.keySet()) { ManagedProfile managed = actionController.getManagedProfile(key); if(managed == null) { throw new NoSuchProfileException(key.getName()); } Set<String> names = mappings.get(key); for(final String deploymentName : names) { DeploymentAction<? extends DeploymentActionContext> action = createWoraroundRemoveAction(key, managed, deploymentName); if(action == null) { action = new DeploymentRemoveAction(managed, deploymentName, null); } actions.addAction(key, action); } } checkStatus(actionController.perform(actions)); }
/** * @return JBoss profile for the {@link Configuration}. */ private ProfileKey getProfile() { String server = this.configuration.getPropertyValue(JBossPropertySet.CONFIGURATION); if (server == null || server.trim().isEmpty()) { server = ProfileKey.DEFAULT; } String profile = this.configuration.getPropertyValue(JBossPropertySet.PROFILE); boolean isClustered = Boolean.parseBoolean(this.configuration.getPropertyValue( JBossPropertySet.CLUSTERED)); String name = isClustered ? "farm" : profile; if (name == null || name.trim().isEmpty()) { name = ProfileKey.DEFAULT; } return new ProfileKey(ProfileKey.DEFAULT, server, name); }
String profileName = key.getName(); String repoDeploymentName = createDeploymentName(vf); deploymentRepository.lockDeploymentContent(repoDeploymentName);
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(); }
private void initProfileService(Server server) throws Exception { Context ctx = server.getNamingContext(); contextInst.set(ctx); profileService = (ProfileService) ctx.lookup("ProfileService"); deploymentManager = profileService.getDeploymentManager(); ProfileKey defaultKey = new ProfileKey(DEFAULT_PROFILE_KEY_NAME); deploymentManager.loadProfile(defaultKey); }