From: <st...@us...> - 2006-10-16 16:54:53
|
Revision: 3481 http://svn.sourceforge.net/smartfrog/?rev=3481&view=rev Author: steve_l Date: 2006-10-16 09:54:24 -0700 (Mon, 16 Oct 2006) Log Message: ----------- Lots of reworking to the workflow bits. Not guaranteed to be working yet (i.e incomplete test coverage). What new tests there are, work, except for some sequence stuff. Modified Paths: -------------- trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompound.java trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java trunk/core/smartfrog/src/org/smartfrog/services/assertions/components.sf trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Container.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Delay.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DetachingCompoundImpl.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/During.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/FireBreak.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Parallel.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/RandomSequence.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Repeat.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Retry.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Run.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Sequence.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Timeout.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Try.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/during.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/eventbus/EventCompoundImpl.java Added Paths: ----------- trunk/core/smartfrog/.svnignore trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlock.java trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlockImpl.java trunk/core/smartfrog/src/org/smartfrog/services/assertions/testblock.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DelayedTerminator.java Removed Paths: ------------- trunk/core/smartfrog/.cvsignore trunk/core/smartfrog/src/org/smartfrog/services/assertions/DelayedTerminator.java Deleted: trunk/core/smartfrog/.cvsignore =================================================================== --- trunk/core/smartfrog/.cvsignore 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/.cvsignore 2006-10-16 16:54:24 UTC (rev 3481) @@ -1,13 +0,0 @@ -build -dist -build.properties -runtime.properties -common.properties -*.jpx -*.ipr -*.iml -*.iws -.classpath -.project -parsertargets_report.html -smartfrog-version.properties Copied: trunk/core/smartfrog/.svnignore (from rev 3465, trunk/core/smartfrog/.cvsignore) =================================================================== --- trunk/core/smartfrog/.svnignore (rev 0) +++ trunk/core/smartfrog/.svnignore 2006-10-16 16:54:24 UTC (rev 3481) @@ -0,0 +1,13 @@ +build +dist +build.properties +runtime.properties +common.properties +*.jpx +*.ipr +*.iml +*.iws +.classpath +.project +parsertargets_report.html +smartfrog-version.properties Property changes on: trunk/core/smartfrog/.svnignore ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Deleted: trunk/core/smartfrog/src/org/smartfrog/services/assertions/DelayedTerminator.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/DelayedTerminator.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/DelayedTerminator.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -1,175 +0,0 @@ -/** (C) Copyright 2006 Hewlett-Packard Development Company, LP - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - For more information: www.smartfrog.org - - */ -package org.smartfrog.services.assertions; - -import org.smartfrog.sfcore.logging.LogSF; -import org.smartfrog.sfcore.prim.Prim; -import org.smartfrog.sfcore.prim.TerminationRecord; -import org.smartfrog.sfcore.reference.Reference; -import org.smartfrog.sfcore.utils.ComponentHelper; - -import java.lang.ref.WeakReference; -import java.rmi.RemoteException; - -/** - * Component to shut down a task after a delay. - * We retain a (weak) reference to a prim. The component can go off teh graph - * and we can still find it, but we dont preclude distributed GC taking place and killing the reference. - */ -public class DelayedTerminator implements Runnable { - private long time; - private WeakReference/*<Prim>*/ primref; - private Throwable terminationFault; - private Thread self; - private boolean shutdown; - private boolean shouldTerminate = true; - private LogSF log; - private String description; - private boolean normalTermination; - private boolean forcedShutdown; - - - /** - * Create a delayed time. - * If the time is -1, then the wait is for {@link Long.MAX_VALUE}, otherwise it - * is for as many milliseconds as needed. - * @param prim - * @param time - * @param log - * @param description - * @param normalTermination - */ - public DelayedTerminator(Prim prim, long time, LogSF log, String description, boolean normalTermination) { - if(time<0) { - time=Long.MAX_VALUE; - } - this.time = time; - this.primref = new WeakReference/*<Prim>*/(prim); - this.log = log; - if (description == null) { - this.description = "Terminate " - + new ComponentHelper(prim).completeNameSafe().toString() - + " after " + time + " milliseconds"; - } else { - this.description = description; - } - this.normalTermination = normalTermination; - } - - public Throwable getTerminationFault() { - return terminationFault; - } - - public void setTerminationFault(Throwable terminationFault) { - this.terminationFault = terminationFault; - } - - - /** - * Call from the owner to shut down the target. - * @param shouldTerminate - * @return - */ - public synchronized void shutdown(boolean shouldTerminate) throws RemoteException { - if (self != null) { - shutdown = true; - shouldTerminate = true; - self.interrupt(); - } - } - - - /** - * Start the new thread - */ - public synchronized void start() { - if(self!=null) { - if (self != null) { - self = new Thread(this); - self.start(); - } - } - } - - /** - * this is the thread that runs in the background - */ - public void run() { - - try { - Thread.sleep(time); - } catch (InterruptedException e) { - //we have been interrupted here. - log.debug("Interrupted " + description); - } - - if (shutdown == true) { - - //initiated shutdown - log.debug("initiated shutdown " + description); - } - - if (shouldTerminate) { - //termination time - Prim target = getTarget(); - if (target == null) { - log.debug("Target no longer exists for " + description); - } else { - try { - if (target.sfIsStarted()) { - forcedShutdown = true; - TerminationRecord record = createTerminationRecord(target); - target.sfTerminate(record); - } - } catch (RemoteException e) { - terminationFault = e; - } - } - } - - synchronized (this) { - //cease to exist - self = null; - primref = null; - } - - } - - private TerminationRecord createTerminationRecord(Prim target) { - Reference ref = new ComponentHelper(target).completeNameSafe(); - TerminationRecord record = new TerminationRecord( - normalTermination ? TerminationRecord.NORMAL : TerminationRecord.ABNORMAL, - "termination by delayed terminator", - ref); - return record; - } - - private Prim getTarget() { - return (Prim) primref.get(); - } - - /** - * Flag set to true if we forced system shutdown - * @return - */ - public synchronized boolean isForcedShutdown() { - return forcedShutdown; - } -} Added: trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlock.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlock.java (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlock.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -0,0 +1,113 @@ +/** (C) Copyright 2006 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ +package org.smartfrog.services.assertions; + +import org.smartfrog.sfcore.prim.TerminationRecord; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.common.SmartFrogException; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** + * created 13-Oct-2006 16:41:10 + */ + + +public interface TestBlock extends Remote { + + + /** + * {@value} + */ + String ATTR_FINISHED = "finished"; + + /** + * {@value} + */ + String ATTR_STATUS = "status"; + /** + * {@value} + */ + String ATTR_FAILED = "failed"; + /** + * {@value} + */ + String ATTR_SUCCEEDED = "succeeded"; + + + /** + * {@value} + */ + String ATTR_TIMEOUT = "timeout"; + + /** + * {@value} + */ + String ATTR_FORCEDTIMEOUT = "forcedTimeout"; + /** + * Name that a deployed action goes by + * {@value} + */ + String ACTION = "_action"; + + /** + * Return true iff the component is finished. + * Spin on this, with a (delay) between calls + * + * @return true if the test has finished + * @throws RemoteException on network trouble + * @throws SmartFrogException on other problems + */ + boolean isFinished() throws RemoteException, SmartFrogException; + + /** + * @return true only if the test has finished and failed + * @throws RemoteException on network trouble + * @throws SmartFrogException on other problems + */ + boolean isFailed() throws RemoteException, SmartFrogException; + + /** + * @return true iff the test succeeded + * @throws RemoteException on network trouble + * @throws SmartFrogException on other problems + */ + + boolean isSucceeded() throws RemoteException, SmartFrogException; + + /** + * Get the exit record + * + * @return the exit record, will be null for an unfinished child + * @throws RemoteException on network trouble + * @throws SmartFrogException on other problems + */ + TerminationRecord getStatus() throws RemoteException, SmartFrogException; + + + /** + * return the current action + * @return the child component. this will be null after termination. + * @throws RemoteException on network trouble + * @throws SmartFrogException on other problems + */ + Prim getAction() throws RemoteException, SmartFrogException; +} Added: trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlockImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlockImpl.java (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestBlockImpl.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -0,0 +1,195 @@ +/** (C) Copyright 2006 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ +package org.smartfrog.services.assertions; + +import org.smartfrog.sfcore.prim.TerminationRecord; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.workflow.eventbus.EventCompoundImpl; +import org.smartfrog.sfcore.workflow.combinators.DelayedTerminator; +import org.smartfrog.sfcore.common.SmartFrogException; +import org.smartfrog.sfcore.common.SmartFrogDeploymentException; +import org.smartfrog.sfcore.utils.ComponentHelper; + +import java.rmi.RemoteException; + +/** + * created 13-Oct-2006 16:46:44 + */ + +public class TestBlockImpl extends EventCompoundImpl implements TestBlock { + + + private volatile boolean finished=false; + private volatile boolean failed = false; + private volatile boolean succeeded = false; + private volatile boolean forcedTimeout = false; + private volatile TerminationRecord status; + private DelayedTerminator actionTerminator; + private volatile Prim child; + public static final String ERROR_STARTUP_FAILURE = "Failed to start up action"; + + public TestBlockImpl() throws RemoteException { + } + + /** + * Return true iff the component is finished. + * Spin on this, with a (delay) between calls + * + * @return + */ + public boolean isFinished() { + return finished; + } + + /** + * @return true only if the test has finished and failed + */ + public boolean isFailed() { + return failed; + } + + /** + * @return true iff the test succeeded + */ + + public boolean isSucceeded() { + return succeeded; + } + + /** + * Get the exit record + * + * @return the exit record, will be null for an unfinished child + */ + public TerminationRecord getStatus() { + return status; + } + + /** + * return the current action + * @return the child component. this will be null after termination. + */ + public Prim getAction() { + return child; + } + + + /** + * Registers components referenced in the SendTo sub-component registers + * itself with components referenced in the RegisterWith sub-component. + * + * @throws java.rmi.RemoteException In case of network/rmi error + * @throws org.smartfrog.sfcore.common.SmartFrogDeploymentException + * In case of any error while + * deploying the component + */ + public synchronized void sfDeploy() throws SmartFrogException, RemoteException { + super.sfDeploy(); + checkActionDefined(); + } + + + /** + * Starts the compound. This sends a synchronous sfStart to all managed + * components in the compound context. Any failure will cause the compound + * to terminate + * + * @throws org.smartfrog.sfcore.common.SmartFrogException + * failed to start compound + * @throws java.rmi.RemoteException In case of Remote/nework error + */ + public synchronized void sfStart() throws SmartFrogException, RemoteException { + super.sfStart(); + long timeout = sfResolve(ATTR_TIMEOUT,0L,true); + try { + child=sfCreateNewChild(ACTION,action, null); + if(timeout>0) { + actionTerminator=new DelayedTerminator(child, timeout, sfLog(),"timeout",false ); + } + } catch (RemoteException e) { + startupException(e); + } catch (SmartFrogDeploymentException e) { + startupException(e); + } + } + + /** + * turn a startup exception into a cleaner exit + * @param e exception + */ + private void startupException(Exception e) { + //this is called if we failed during startup + TerminationRecord fault = TerminationRecord.abnormal(ERROR_STARTUP_FAILURE, name, e); + end(fault); + } + + /** + * log the end of the event. This may trigger workflow termination. + * does nothing if finished==true. + * @param record + */ + private synchronized void end(TerminationRecord record) { + if(finished) { + //non-reentrant + return; + } + finished=true; + status = record; + succeeded=record.isNormal(); + failed=!succeeded; + if(actionTerminator!=null) { + //test to see if the terminator caused the shutdown + forcedTimeout = actionTerminator.isForcedShutdown(); + //and terminate it quietly too. + actionTerminator.shutdown(false); + actionTerminator = null; + } + //this can trigger a shutdown if we want it + new ComponentHelper(this).sfSelfDetachAndOrTerminate(record); + } + + + /** + * This is an override point; it is where subclasses get to change their workflow + * depending on what happens underneath. + * It is only called outside of component termination, i.e. when {@link #isWorkflowTerminating()} is + * false, and when the comp parameter is a child, that is <code>sfContainsChild(comp)</code> holds. + * If the the method returns true, the event is forwarded up the object heirarchy, which + * will eventually trigger a component termination. + * <p/> + * Always return false if you start new components from this method! + * </p> + * + * @param status exit record of the component + * @param comp child component that is terminating + * @return true if the termination event is to be forwarded up the chain. + */ + protected boolean onChildTerminated(TerminationRecord status, Prim comp) { + if(comp==child) { + //this is the action terminating, so log the closure and continue + end(status); + return false; + } else { + //something unknown + return true; + } + } + +} Modified: trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompound.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompound.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompound.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -63,6 +63,13 @@ String ATTR_TESTS = "tests"; /** + * Time in milliseconds for the tests to successfully finish, use -1 for no limit. + * If this is set, then the tests are deemed to have failed if they have not finished + * by the time the tests are forcibly terminated + */ + String ATTR_TEST_TIMEOUT = "testTimeout"; + + /** * a component that is run after the tests pass/fail to perform teardown or post-process. the action will always have been terminated (cleanly or not) Modified: trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -25,8 +25,8 @@ import org.smartfrog.sfcore.logging.LogSF; import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.prim.TerminationRecord; -import org.smartfrog.sfcore.prim.PrimImpl; import org.smartfrog.sfcore.workflow.eventbus.EventCompoundImpl; +import org.smartfrog.sfcore.workflow.combinators.DelayedTerminator; import org.smartfrog.sfcore.utils.ComponentHelper; import org.smartfrog.sfcore.componentdescription.ComponentDescription; @@ -37,22 +37,23 @@ */ public class TestCompoundImpl extends EventCompoundImpl implements TestCompound { - protected ComponentDescription teardownCD; - protected Prim teardown; + private ComponentDescription teardownCD; + private Prim teardown; - protected ComponentDescription testsCD; - protected Prim tests; + private ComponentDescription tests; + private Prim testsPrim; protected static final String ACTION_RUNNING = "_actionRunning"; - protected long undeployAfter; - protected boolean expectTerminate; - protected DelayedTerminator actionTerminator; - protected DelayedTerminator testsTerminator; - protected Prim actionPrim; - protected boolean terminating=false; - protected String exitType; + protected static final String TESTS_RUNNING = "_testsRunning"; + private long undeployAfter; + private long testTimeout; + private boolean expectTerminate; + private DelayedTerminator actionTerminator; + private DelayedTerminator testsTerminator; + private Prim actionPrim; + private String exitType; - protected String exitText; + private String exitText; /** * The message of a forced shutdown. This is important, as we look for * it when the component is terminated, and can use its presence to infer @@ -78,15 +79,13 @@ super.sfDeploy(); checkActionDefined(); name = sfCompleteNameSafe(); - testsCD = sfResolve(ATTR_TESTS, testsCD, false); - if (testsCD != null) { - throw new SmartFrogException("Not yet supported " + ATTR_TESTS); - } + tests = sfResolve(ATTR_TESTS, tests, false); + testTimeout = sfResolve(ATTR_TEST_TIMEOUT, 0L, true); teardownCD = sfResolve(ATTR_TEARDOWN, teardownCD, false); if (teardownCD != null) { throw new SmartFrogException("Not yet supported " + ATTR_TEARDOWN); } - undeployAfter = sfResolve(ATTR_UNDEPLOY_AFTER, 0,true); + undeployAfter = sfResolve(ATTR_UNDEPLOY_AFTER, 0L,true); expectTerminate = sfResolve(ATTR_EXPECT_TERMINATE,false,true); exitType = sfResolve(ATTR_EXIT_TYPE,exitType,true); exitText = sfResolve(ATTR_EXIT_TEXT, exitText, true); @@ -134,9 +133,15 @@ } //now deploy the tests. - //these are expected to pass + //any failure in tests is something to report, as is any failure of the tests to finish. - + if(tests !=null) { + testsPrim = sfCreateNewChild(TESTS_RUNNING, tests, null); + //the test terminator reports a termination as a failure + testsTerminator = new DelayedTerminator(testsPrim, testTimeout, logSF, + FORCED_TERMINATION, + false); + } } /** @@ -162,37 +167,51 @@ if(actionPrim!=null) { sfPingChildAndTerminateOnFailure(actionPrim); } - if (tests != null) { - sfPingChildAndTerminateOnFailure(tests); + if (testsPrim != null) { + sfPingChildAndTerminateOnFailure(testsPrim); } } public synchronized void sfTerminateWith(TerminationRecord status) { - terminating=true; super.sfTerminateWith(status); - if (actionTerminator!=null) { - //shut down the action terminator if we need to. We assume the superclass - //terminator is already terminating the children, so there is no need - //to tell the action terminator to do it. - try { - actionTerminator.shutdown(false); - } catch (RemoteException e) { - sfLog().error("When shutting down the action terminator",e); - } + shutdown(actionTerminator); + shutdown(testsTerminator); + } + + /** + * shut down the action terminator if we need to. We assume the superclass + * terminator is already terminating the children, so there is no need + * to tell the action terminator to do it. Therefore, this should only be called + * from sfTerminateWith + * + * @param terminator + */ + private void shutdown(DelayedTerminator terminator) { + if (terminator !=null) { + terminator.shutdown(false); } } + /** - * Called when a child terminates, either normally or abnormally. - * @param status - * @param comp + * This is an override point; it is where subclasses get to change their workflow + * depending on what happens underneath. + * It is only called outside of component termination, i.e. when {@link #isWorkflowTerminating()} is + * false, and when the comp parameter is a child, that is <code>sfContainsChild(comp)</code> holds. + * If the the method returns true, the event is forwarded up the object heirarchy, which + * will eventually trigger a component termination. + * <p/> + * Always return false if you start new components from this method! + * </p> + * + * @param status exit record of the component + * @param comp child component that is terminating + * @return true if the termination event is to be forwarded up the chain. */ - public void sfTerminatedWith(TerminationRecord status, Prim comp) { - - if (terminating) { - super.sfTerminatedWith(status,comp); - return; - } + protected boolean onChildTerminated(TerminationRecord status, Prim comp) { + boolean forward=true; + boolean tearDownTime=false; + TerminationRecord error=null; if (actionPrim == comp) { if (actionTerminator.isForcedShutdown() && expectTerminate == false) { //this is a forced shutdown, all is well @@ -227,16 +246,46 @@ + "and error text " + exitText + "\n" + "but got " + status; sfLog().error(errorText); - status = TerminationRecord.abnormal(errorText, status.id); + error = TerminationRecord.abnormal(errorText, status.id); } } + tearDownTime=true; + } else if(comp == testsPrim) { + //tests are terminating. + //it is an error if these terminated abnormally, for any reason at all. + //that is: test failure triggers an undeployment. + //There is no need to check this, because its implicit. + if(!status.isNormal()) { + sfLog().info("Tests have failed"); + } + tearDownTime=true; } - //TODO: start teardown, etc. - //trigger workflow termination. - new ComponentHelper(this).sfSelfDetachAndOrTerminate(status); + //start teardown, etc. + //kicks in on normal abnormal ter + if(tearDownTime && teardownCD!=null) { + try { + sfCreateNewChild(name + "_teardownRunning", teardownCD, null); + forward = false; + } catch (Exception e) { + error = TerminationRecord.abnormal("failed to start teardown", + name,e); + } + } + + //if the error record is non null, terminate ourselves with the new record + if (error != null) { + sfTerminate(error); + //dont forward, as we are terminating with an error + forward = false; + } + //trigger termination. + return forward; } + + + protected Prim deployAction() throws RemoteException, SmartFrogDeploymentException { Prim child = sfCreateNewChild(ACTION_RUNNING, action, null); return child; Modified: trunk/core/smartfrog/src/org/smartfrog/services/assertions/components.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/components.sf 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/components.sf 2006-10-16 16:54:24 UTC (rev 3481) @@ -30,6 +30,7 @@ #include "/org/smartfrog/components.sf" #include "/org/smartfrog/predicates.sf" #include "/org/smartfrog/services/assertions/testcomponents.sf" + #include "/org/smartfrog/services/assertions/testblock.sf" /** @@ -79,7 +80,7 @@ * the assert component can be used to declare invariants which * must hold for the system to be valid */ -Assert extends Prim { +Assert extends WorkflowPrim { assertSchema extends Schema; sfClass "org.smartfrog.services.assertions.AssertComponent"; isTrue true; @@ -90,8 +91,6 @@ } - - /** * This is a component that will fail on demand. * Its original role was for testing workflows such as repeat, retry, etc, Added: trunk/core/smartfrog/src/org/smartfrog/services/assertions/testblock.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/testblock.sf (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/testblock.sf 2006-10-16 16:54:24 UTC (rev 3481) @@ -0,0 +1,56 @@ +/** (C) Copyright 2006 Hewlett-Packard Development Company, LP + +Disclaimer of Warranty + +The Software is provided "AS IS," without a warranty of any kind. ALL +EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE HEREBY +EXCLUDED. SmartFrog is not a Hewlett-Packard Product. The Software has +not undergone complete testing and may contain errors and defects. It +may not function properly and is subject to change or withdrawal at +any time. The user must assume the entire risk of using the +Software. No support or maintenance is provided with the Software by +Hewlett-Packard. Do not install the Software if you are not accustomed +to using experimental software. + +Limitation of Liability + +TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL HEWLETT-PACKARD +OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR +FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, +HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF +OR RELATED TO THE FURNISHING, PERFORMANCE, OR USE OF THE SOFTWARE, OR +THE INABILITY TO USE THE SOFTWARE, EVEN IF HEWLETT-PACKARD HAS BEEN +ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. FURTHERMORE, SINCE THE +SOFTWARE IS PROVIDED WITHOUT CHARGE, YOU AGREE THAT THERE HAS BEEN NO +BARGAIN MADE FOR ANY ASSUMPTIONS OF LIABILITY OR DAMAGES BY +HEWLETT-PACKARD FOR ANY REASON WHATSOEVER, RELATING TO THE SOFTWARE OR +ITS MEDIA, AND YOU HEREBY WAIVE ANY CLAIM IN THIS REGARD. + +*/ + +#include "/org/smartfrog/sfcore/workflow/eventbus/eventbus.sf" + +/** + * the testblock component is for ease of testing from JUnit tests which talk to this deployed + * component using RMI. + * It deploys its action and remembers whether or not the result was successful or not. + * success/failure results are stored as attributes. + * + * It does not terminate until asked, by default. + */ +TestBlock extends ActionCompound { + + sfClass "org.smartfrog.services.assertions.TestBlockImpl"; + //timeout in milliseconds + timeout 0; + + //finished: boolean + //status -> exit status + //failed: boolean + //succeeded: boolean + //forcedtimeout: boolean , true iff timeout was forced + + +} \ No newline at end of file Modified: trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf 2006-10-16 16:54:24 UTC (rev 3481) @@ -31,22 +31,21 @@ */ + /** + * Include the core smartfrog components. + */ +#include "/org/smartfrog/sfcore/workflow/combinators/sequence.sf" + /* this file declares components that can act as test deployers. - 1. The tests are all workflow compoundsl they run a test, then assertions + This isthe */ - - /** - * Include the core smartfrog components. - */ -#include "/org/smartfrog/sfcore/workflow/combinators/sequence.sf" - TestCompound extends ActionCompound { TestCompoundSchema extends Schema { description extends String { @@ -81,7 +80,6 @@ description ## time in milliseconds to trigger an exception if the tests do not finish; use -1 for no limit" - NOT IMPLEMENTED #; } teardown extends OptionalCD { @@ -115,6 +113,8 @@ //default to one minute undeployAfter 60000; + //no delay by default + testTimeout -1; //default to one minute startupTimeout 60000; //default to one minute @@ -192,4 +192,4 @@ forcePing true; pingInterval 0; -} \ No newline at end of file +} Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Container.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Container.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Container.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -47,9 +47,9 @@ * @throws java.rmi.RemoteException In case of network or RMI failure. */ public Container() throws java.rmi.RemoteException { - super(); } + /** * It is invoked by sub-components at * termination. It simply removes the child and continues to run @@ -57,18 +57,29 @@ * @param status termination status of sender * @param comp sender of termination */ - public void sfTerminatedWith(TerminationRecord status, Prim comp) { - if (sfContainsChild(comp)) { - try { - sfRemoveChild(comp); - } catch (Exception e) { - if (sfLog().isErrorEnabled()) { - sfLog().error(this.sfCompleteNameSafe()+ " - error handling child termination ", e); - } + /** + * If normal termination, Parallel behaviour is to terminate + * that component but leave the others running if it is the last - + * terminate normally. if an erroneous termination - + * terminate immediately passing on the error + * + * + * @param status exit record of the component + * @param comp child component that is terminating + * @return true if the termination event is to be forwarded up the chain. + */ + protected boolean onChildTerminated(TerminationRecord status, Prim comp) { + try { + sfRemoveChild(comp); + } catch (Exception e) { + if (sfLog().isErrorEnabled()) { + sfLog().error(this.sfCompleteNameSafe() + " - error handling child termination ", e); } } + return false; } + /** * Handle ping failures. Default behavior is to terminate with a liveness * send failure record storing the name of the target of the ping when the failure Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Delay.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Delay.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Delay.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -46,43 +46,34 @@ * may be passed to Delay. * </p> */ -public class Delay - extends EventCompoundImpl implements Compound { +public class Delay extends EventCompoundImpl implements Compound, Runnable { protected static final String ATTR_TIME = "time"; /** * Reference for attribute time */ static Reference timeRef = new Reference(ATTR_TIME); - /** - * ComponentDescription - */ - ComponentDescription action; /** * Time taken. */ - int time; - /** - * Name of the component. - */ - Reference name; + private int time; /** * Timer thread. */ - Thread timer; + private volatile Thread timer; /** * Indication that the component has been terminated before the time fires */ - private boolean terminated = false; + private volatile boolean terminated = false; /** * Constructs Delay object. * * @throws java.rmi.RemoteException In case of RMI or network failure. */ - public Delay() throws java.rmi.RemoteException { + public Delay() throws RemoteException { super(); } @@ -99,7 +90,6 @@ super.sfDeploy(); checkActionDefined(); time = ((Integer)sfResolve(timeRef)).intValue(); - name = sfCompleteNameSafe(); } /** @@ -112,50 +102,68 @@ public synchronized void sfStart() throws SmartFrogException, RemoteException { super.sfStart(); - timer = new Thread(new Runnable() { - public void run() { - if (time>0) { - try { - Thread.sleep(time); - } catch (Exception e) { - // ignore - } - if (!terminated) { - try { - synchronized (this) { - (Delay.this).sfCreateNewChild(name+"_actionRunning", action, null); - } - } catch (Exception e) { - (Delay.this).sfTerminate(TerminationRecord.abnormal( - "error in launching delayed component", null)); - } - } - } - } - }); + timer = new Thread(this); timer.start(); } + /** - * Terminates the component. It is invoked by sub-components at - * termination. If normal termination, Delay behaviour is to terminate - * normally, otherwise abnormally. + * If normal termination, Parallel behaviour is to terminate + * that component but leave the others running if it is the last - + * terminate normally. if an erroneous termination - + * terminate immediately passing on the error * - * @param status termination status of sender - * @param comp sender of termination + * + * @param status exit record of the component + * @param comp child component that is terminating + * @return true if the termination event is to be forwarded up the chain. */ - public synchronized void sfTerminatedWith(TerminationRecord status, - Prim comp) { - if (sfContainsChild(comp)) { - if (timer!=null) { + protected boolean onChildTerminated(TerminationRecord status, Prim comp) { + killTimer(); + return true; + } + + /** + * kill the timer. + */ + private void killTimer() { + //copy + Thread t; + //copy so that even if the timer nulls itself during termination, the cached reference is + //still held. + t = timer; + if (t!=null) { + terminated = true; + t.interrupt(); + } + } + + + /** + * This routine runs in the background thread; it sleeps until its time is up + */ + public void run() { + try { + if (time > 0) { try { - terminated = true; - timer.interrupt(); - } catch (Exception e) { - //ignore + Thread.sleep(time); + } catch (InterruptedException ignored) { + // ignore } } - sfTerminate(status); + synchronized (this) { + if (!terminated && !isWorkflowTerminating()) { + try { + sfCreateNewChild(name + "_actionRunning", action, null); + } catch (Exception e) { + sfTerminate(TerminationRecord.abnormal( + "error in launching delayed component", name, e)); + } + } + } + } finally { + //now, cease to exit. + timer = null; } } } Copied: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DelayedTerminator.java (from rev 3465, trunk/core/smartfrog/src/org/smartfrog/services/assertions/DelayedTerminator.java) =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DelayedTerminator.java (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DelayedTerminator.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -0,0 +1,197 @@ +/** (C) Copyright 2006 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ +package org.smartfrog.sfcore.workflow.combinators; + +import org.smartfrog.sfcore.logging.LogSF; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.prim.TerminationRecord; +import org.smartfrog.sfcore.reference.Reference; +import org.smartfrog.sfcore.utils.ComponentHelper; + +import java.lang.ref.WeakReference; +import java.rmi.RemoteException; + +/** + * Component to shut down a task after a delay. + * We retain a (weak) reference to a prim. The component can go off the graph + * and we can still find it, but we don't preclude distributed GC taking place and killing the reference. + * This stops accidental retention of a terminator thread from keeping the prim around. + */ +public class DelayedTerminator implements Runnable { + private long time; + private WeakReference/*<Prim>*/ primref; + private Throwable terminationFault; + private volatile Thread self; + private volatile boolean shutdown; + private volatile boolean shouldTerminate = true; + private LogSF log; + private String description; + private volatile boolean normalTermination; + private volatile boolean forcedShutdown; + private String name; + + + /** + * Create a delayed time. + * If the time is -1, then the wait is for {@link Long#MAX_VALUE}, otherwise it + * is for as many milliseconds as needed. + * @param prim + * @param time + * @param log + * @param description + * @param normalTermination + */ + public DelayedTerminator(Prim prim, long time, LogSF log, String description, boolean normalTermination) { + if(time<0) { + time=Long.MAX_VALUE; + } + this.time = time; + primref = new WeakReference/*<Prim>*/(prim); + this.log = log; + if (description == null) { + this.description = "Terminate " + + new ComponentHelper(prim).completeNameSafe().toString() + + " after " + time + " milliseconds"; + } else { + this.description = description; + } + this.normalTermination = normalTermination; + } + + public Throwable getTerminationFault() { + return terminationFault; + } + + public void setTerminationFault(Throwable terminationFault) { + this.terminationFault = terminationFault; + } + + + public boolean isNormalTermination() { + return normalTermination; + } + + public void setNormalTermination(boolean normalTermination) { + this.normalTermination = normalTermination; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Call from the owner to shut down the target. + * @param terminateTarget should we terminate the child? + */ + public synchronized void shutdown(boolean terminateTarget) { + if (self != null) { + shutdown = true; + this.shouldTerminate = terminateTarget; + self.interrupt(); + } + } + + + /** + * Start the new thread + */ + public synchronized void start() { + if(self!=null) { + if (self != null) { + self = new Thread(this); + if(name!=null) { + self.setName(name); + } + self.start(); + } + } + } + + /** + * this is the thread that runs in the background + */ + public void run() { + + try { + Thread.sleep(time); + } catch (InterruptedException e) { + //we have been interrupted here. + log.debug("Interrupted " + description); + } + + synchronized (this) { + try { + if (shutdown == true) { + + //initiated shutdown + log.debug("initiated shutdown " + description); + } + + if (shouldTerminate) { + //termination time + Prim target = getTarget(); + if (target == null) { + log.debug("Target no longer exists for " + description); + } else { + try { + if (target.sfIsStarted()) { + forcedShutdown = true; + TerminationRecord record = createTerminationRecord(target); + target.sfTerminate(record); + } + } catch (RemoteException e) { + terminationFault = e; + } + } + } + } finally { + //cease to exist + self = null; + primref = null; + } + } + + } + + private TerminationRecord createTerminationRecord(Prim target) { + Reference ref = new ComponentHelper(target).completeNameSafe(); + TerminationRecord record = new TerminationRecord( + normalTermination ? TerminationRecord.NORMAL : TerminationRecord.ABNORMAL, + "termination by delayed terminator", + ref); + return record; + } + + private Prim getTarget() { + return (Prim) primref.get(); + } + + /** + * Flag set to true if we forced system shutdown + * @return whether system was forced + */ + public synchronized boolean isForcedShutdown() { + return forcedShutdown; + } +} Property changes on: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DelayedTerminator.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DetachingCompoundImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DetachingCompoundImpl.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/DetachingCompoundImpl.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -43,30 +43,20 @@ /** * Name of the component. */ - Reference name = null; + private Reference name = null; /** * Set to true if you want the compound to detach its children on start */ - boolean detachDownwards; + private boolean detachDownwards; /** * Set to true if you want the compound to detach itself on start */ - boolean detachUpwards; + private boolean detachUpwards; /** - * Set to true if you want the compound to terminate at the end of the + * Set to true if you want the compound to terminate at the end of the run */ - boolean autoDestruct; + private boolean autoDestruct; /** - * Flag to indicate terminate is called. - */ - boolean terminateCalled = false; - /** - * A thread for lifecycle operations during the start phase - */ - Thread detacher; - - // boolean normalDeath = true; - /** * Constructs DetachingCompoundImpl. * @throws RemoteException if there is any network or RMI error */ @@ -108,65 +98,70 @@ public synchronized void sfStart() throws SmartFrogException, RemoteException { try { super.sfStart(); - detacher = new Thread(new Runnable() { - public void run() { - // detach this compound - if (detachUpwards) { - try { - sfDetach(); - } catch (SmartFrogException dex) { - sfTerminate(TerminationRecord.abnormal( - "DetachingCompound failed to detach ", - null)); + Thread detacher = new Thread(new Detacher()); - return; - } catch (RemoteException rex) { - sfTerminate(TerminationRecord.abnormal( - "DetachingCompound failed to detach due to remote exception", - null)); + if (detachDownwards || detachUpwards || autoDestruct) { + detacher.start(); + } + } catch (Throwable t) { // catch throwable as user code is involved + throw SmartFrogLifecycleException.sfDeploy("",t , this); + } + } - return; - } - } + /** + * Non-static inner class to handle detachment + */ + private class Detacher implements Runnable { + public void run() { + // detach this compound + if (detachUpwards) { + try { + sfDetach(); + } catch (SmartFrogException dex) { + sfTerminate(TerminationRecord.abnormal( + "DetachingCompound failed to detach ", + null)); - if (detachDownwards) { - // detach all children - for (Enumeration e = sfChildren(); - e.hasMoreElements();) { - try { - ((Prim) e.nextElement()).sfDetach(); - } catch (SmartFrogException remex) { - sfTerminate(TerminationRecord.abnormal( - "DetachingCompound failed to detach children", - null)); + return; + } catch (RemoteException rex) { + sfTerminate(TerminationRecord.abnormal( + "DetachingCompound failed to detach due to remote exception", + null)); - return; - } catch (RemoteException rex) { - sfTerminate(TerminationRecord.abnormal( - "DetachingCompound failed to detach children due to remote exception", - null)); + return; + } + } - return; - } - } + if (detachDownwards) { + // detach all children + for (Enumeration e = sfChildren(); + e.hasMoreElements();) { + try { + ((Prim) e.nextElement()).sfDetach(); + } catch (SmartFrogException remex) { + sfTerminate(TerminationRecord.abnormal( + "DetachingCompound failed to detach children", + null)); - if (autoDestruct) { - try { - name = sfCompleteName(); - } catch (Exception e) { - } + return; + } catch (RemoteException rex) { + sfTerminate(TerminationRecord.abnormal( + "DetachingCompound failed to detach children due to remote exception", + null)); - sfTerminate(TerminationRecord.normal(name)); - } - } - } - }); + return; + } + } - if (detachDownwards || detachUpwards || autoDestruct) { - detacher.start(); + if (autoDestruct) { + try { + name = sfCompleteName(); + } catch (Exception e) { + } + + sfTerminate(TerminationRecord.normal(name)); + } } - } catch (Throwable t) { // catch throwable as user code is involved - throw SmartFrogLifecycleException.sfDeploy("",t , this); } } } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/During.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/During.java 2006-10-16 16:53:00 UTC (rev 3480) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/During.java 2006-10-16 16:54:24 UTC (rev 3481) @@ -57,16 +57,13 @@ /** * Time taken. */ - int time; + private int time; + /** - * Timer thread. + * Terminator thread */ - Thread timer; + private DelayedTerminator terminator; - boolean abortTimer = false; - - String name = ""; - /** * Constructs During. * @@ -100,44 +97,77 @@ */ public synchronized void sfStart() throws SmartFrogException, RemoteException { super.sfStart(); - name = sfCompleteNameSafe().toString(); - Runnable terminator = new Runnable() { - public void run() { - if (sfLog().isDebugEnabled()) { sfLog().debug("Timer set:" +time+". Going to sleep "+name);} - if (time > 0) { - try { Thread.sleep(time); } catch (Exception ex) { if (abortTimer) return; } - String terminationMessage = "Timer '"+time+"' expired. Terminating "+name; - if (sfLog().isDebugEnabled()) { sfLog().debug(terminationMessage);} - sfTerminate(new TerminationRecord(TerminationRecord.NORMAL, terminationMessage , null)); - } - } - }; - timer = new Thread(terminator); - timer.setName(name+"_DuringTerminator"); - timer.start(); - + terminator=new DelayedTerminator(this,time,sfLog(), name + "_DuringTerminator",true); + terminator.start(); sfCreateNewChild(name+"_duringActionRunning", action, null); } + /** - * Terminates the component. This is invoked by sub-components on - * termination. If normal termiantion, Timeout behaviour is to terminate - * normally, otherwise abnormally. + * Deregisters from all current registrations. * - * @param status termination status of sender - * @param comp sender of termination + * @param status Termination Record */ - public void sfTerminatedWith(TerminationRecord status, Prim comp) { - if (sfContainsChild(comp)) { - if (timer != null) { + public synchronized void sfTerminateWith(TerminationRecord status) { + super.sfTerminateWith(status); + killTimer(); + } + + /** + * Kill the timer if it is running. does nothing otherwise + */ + private synchronized void killTimer() { + if (terminator != null) { + terminator.shutdown(false); + } + } + + + /** + * This is an override point; it is where subclasses get to change their workflow + * depending on what happens underneath. + * It is only called outside of component termination, i.e. when {@link #isWorkflowTerminating()} is + * false, and when the comp parameter is a child, that is <code>sfContainsChild(comp)</code> holds. + * If the the method returns true, the event is forwarded up the object heirarchy, which + * will eventually trigger a component termination. + * <p/> + * Always return false if you start new components from this method! + * </p> + * + * @param status exit record of the component + * @param comp child component that is terminating + * @return true if the termination event is to be forwarded up the chain. + */ + protected boolean onChildTerminated(TerminationRecord status, Prim comp) { + killTimer(); + return true; + } + +/* this is the old runnable factored out to show what the logic was. + as of 3.10.0 it was broken to the extent that if time<= 0, the terminator +... [truncated message content] |
From: <st...@us...> - 2006-10-20 16:33:49
|
Revision: 3506 http://svn.sourceforge.net/smartfrog/?rev=3506&view=rev Author: steve_l Date: 2006-10-20 09:32:03 -0700 (Fri, 20 Oct 2006) Log Message: ----------- ASF compliance, some tuning of #includes Modified Paths: -------------- trunk/core/smartfrog/COPYRIGHT.txt trunk/core/smartfrog/src/org/smartfrog/services/filesystem/filesystemtemplate.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToStreamsImpl.java Modified: trunk/core/smartfrog/COPYRIGHT.txt =================================================================== --- trunk/core/smartfrog/COPYRIGHT.txt 2006-10-20 16:30:32 UTC (rev 3505) +++ trunk/core/smartfrog/COPYRIGHT.txt 2006-10-20 16:32:03 UTC (rev 3506) @@ -1,4 +1,4 @@ -/** (C) Copyright 1998-2006 Hewlett-Packard Development Company, LP +(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,4 +16,25 @@ For more information: www.smartfrog.org -*/ \ No newline at end of file + +Some parts of this project are dervied from software +produced by the Apache Software Foundation, for which the following +copyright terms apply: + +Copyright 2001-2004 The Apache Software Foundation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +File to which this apply are: +org.smartfrog.sfcore.common.Diagnostics +org.smartfrog.sfcore.logging.LogToStreamsImpl \ No newline at end of file Modified: trunk/core/smartfrog/src/org/smartfrog/services/filesystem/filesystemtemplate.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/filesystem/filesystemtemplate.sf 2006-10-20 16:30:32 UTC (rev 3505) +++ trunk/core/smartfrog/src/org/smartfrog/services/filesystem/filesystemtemplate.sf 2006-10-20 16:32:03 UTC (rev 3506) @@ -18,7 +18,6 @@ */ #include "/org/smartfrog/components.sf" -#include "/org/smartfrog/predicates.sf" DeletableFileSchema extends Schema { //delete flag Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToStreamsImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToStreamsImpl.java 2006-10-20 16:30:32 UTC (rev 3505) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToStreamsImpl.java 2006-10-20 16:32:03 UTC (rev 3506) @@ -1,4 +1,41 @@ +/** (C) Copyright 2006 Hewlett-Packard Development Company, LP + +Disclaimer of Warranty + +The Software is provided "AS IS," without a warranty of any kind. ALL +EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE HEREBY +EXCLUDED. SmartFrog is not a Hewlett-Packard Product. The Software has +not undergone complete testing and may contain errors and defects. It +may not function properly and is subject to change or withdrawal at +any time. The user must assume the entire risk of using the +Software. No support or maintenance is provided with the Software by +Hewlett-Packard. Do not install the Software if you are not accustomed +to using experimental software. + +Limitation of Liability + +TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL HEWLETT-PACKARD +OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR +FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, +HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF +OR RELATED TO THE FURNISHING, PERFORMANCE, OR USE OF THE SOFTWARE, OR +THE INABILITY TO USE THE SOFTWARE, EVEN IF HEWLETT-PACKARD HAS BEEN +ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. FURTHERMORE, SINCE THE +SOFTWARE IS PROVIDED WITHOUT CHARGE, YOU AGREE THAT THERE HAS BEEN NO +BARGAIN MADE FOR ANY ASSUMPTIONS OF LIABILITY OR DAMAGES BY +HEWLETT-PACKARD FOR ANY REASON WHATSOEVER, RELATING TO THE SOFTWARE OR +ITS MEDIA, AND YOU HEREBY WAIVE ANY CLAIM IN THIS REGARD. + +*/ + /* + * This class is derived (with modifications) from Apache Software Foundation + * code + */ + +/* * Copyright 2001-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2006-11-14 16:18:54
|
Revision: 3592 http://svn.sourceforge.net/smartfrog/?rev=3592&view=rev Author: steve_l Date: 2006-11-14 08:17:11 -0800 (Tue, 14 Nov 2006) Log Message: ----------- These are for Ivy use. Added Paths: ----------- trunk/core/smartfrog/ivy.xml trunk/core/smartfrog/ivyconf.xml Added: trunk/core/smartfrog/ivy.xml =================================================================== --- trunk/core/smartfrog/ivy.xml (rev 0) +++ trunk/core/smartfrog/ivy.xml 2006-11-14 16:17:11 UTC (rev 3592) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?> +<ivy-module version="1.4" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../antbuild/ivy/ivy.xsd" + > + <info organisation="org.smartfrog" module="smartfrog"/> + <!-- define our configurations, based on the maven set --> + <configurations defaultconfmapping="default"> + <conf name="compile" visibility="private"/> + <conf name="test" extends="compile" visibility="private"/> + <conf name="master" description="contains the artifact but no dependencies"/> + <conf name="runtime" description="runtime but not the artifact"/> + <conf name="default" extends="master,runtime"/> + <conf name="javacc" visibility="private"/> + </configurations> + <publications> + <!--get the artifact from our module name--> + <artifact name="${smartfrog.title}"/> + <artifact name="${sf-examples.title}" /> + <artifact name="${sf-services.title}"/> + </publications> + <dependencies> + + <!--javacc is used for the javacc task--> + <dependency org="net.java.dev.javacc" name="javacc" rev="3.2" + conf="javacc->default"/> + </dependencies> +</ivy-module> \ No newline at end of file Added: trunk/core/smartfrog/ivyconf.xml =================================================================== --- trunk/core/smartfrog/ivyconf.xml (rev 0) +++ trunk/core/smartfrog/ivyconf.xml 2006-11-14 16:17:11 UTC (rev 3592) @@ -0,0 +1,47 @@ +<ivyconf> + <!-- + see http://www.jayasoft.org/ivy/doc/configuration + --> + <!-- you can override this property to use mirrors + http://mirrors.dotsrc.org/maven2 + http://ftp.ggi-project.org/pub/packages/maven2 + http://mirrors.sunsite.dk/maven2 + http://public.planetmirror.com/pub/maven2 + http://ibiblio.lsu.edu/main/pub/packages/maven2 + http://www.ibiblio.net/pub/packages/maven2 + --> + <property name="ibiblio-maven2-root" + value="http://www.ibiblio.org/maven2/" override="false"/> + <property name="maven2.pattern" + value="[organisation]/[module]/[revision]/[module]-[revision]"/> + <property name="maven2.pattern.ext" + value="${maven2.pattern}.[ext]"/> + <!-- pull in the local repository --> + <include url="${ivy.default.conf.dir}/ivyconf-local.xml"/> + <conf defaultResolver="default"/> + <resolvers> + <filesystem name="team"> + ivys="true" artifacts="true" + m2compatible="true" > + <artifact pattern="${ivy.conf.dir}/repository/${maven2.pattern.ext}"/> + <ivy pattern="${ivy.conf.dir}/repository/${maven2.pattern}.xml"/> + </filesystem> + <ibiblio name="maven2" + root="${ibiblio-maven2-root}" + pattern="${maven2.pattern.ext}" + m2compatible="true" + /> + <chain name="default" dual="true"> + <resolver ref="local"/> + <resolver ref="team"/> + <resolver ref="maven2"/> + </chain> + <chain name="internal"> + <resolver ref="local"/> + <resolver ref="team"/> + </chain> + </resolvers> + <modules> + <module organisation="org.antbook" name=".*" resolver="internal"/> + </modules> +</ivyconf> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2006-11-14 17:41:34
|
Revision: 3594 http://svn.sourceforge.net/smartfrog/?rev=3594&view=rev Author: julgui Date: 2006-11-14 09:41:27 -0800 (Tue, 14 Nov 2006) Log Message: ----------- ADD: management console can now be deployed as a component and the root can be defined using 'root' attribute. Also, it is now possible to deploy the daemon console with the management tab enabled for the local process. Modified Paths: -------------- trunk/core/smartfrog/bin/default.sf trunk/core/smartfrog/src/org/smartfrog/services/display/WindowUtilities.java trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreeModelSF.java trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreePanel.java trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java trunk/core/smartfrog/src/org/smartfrog/services/management/SFDeployDisplay.java trunk/core/smartfrog/src/org/smartfrog/services/management/components.sf Modified: trunk/core/smartfrog/bin/default.sf =================================================================== --- trunk/core/smartfrog/bin/default.sf 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/bin/default.sf 2006-11-14 17:41:27 UTC (rev 3594) @@ -33,9 +33,9 @@ #include "org/smartfrog/services/display/components.sf" #include "org/smartfrog/services/trace/components.sf" #include "org/smartfrog/components.sf" +#include "org/smartfrog/services/management/components.sf" - // Default sfDaemon Display DefaultDisplay extends Display { nameDisplay "sfDaemon Display"; // Window Title @@ -46,6 +46,17 @@ terminateSFProcessOnExit true; // Terminates sfDaemon when window is closed }; +DefaultManagementDisplay extends DeployManagement { + nameDisplay "sfDaemon Management Display"; // Window Title + positionDisplay "NE"; // Window position: North-West + redirectStd true; // Redirect std output and error to this wind. + showIP true; // Show IP address in window title + showSfProcess true; // Show sfProcess name in window title + terminateSFProcessOnExit true; // Terminates sfDaemon when window is closed + root LAZY PROCESS; +} + + DisplayTrace extends TraceDisplay{ nameDisplay "Trace info (Exit:ALT+F4)"; formatMsg true; @@ -57,6 +68,11 @@ display extends DefaultDisplay; } +DefaultManagementCompound extends DefaultManagementDisplay { + sfProcessComponentName "sfDefault"; + display extends DefaultDisplay; +} + DefaultTraceDisplayCompound extends DefaultCompound { displayTrace extends DisplayTrace; trace extends Trace{ // Component lifecycle trace notification @@ -81,6 +97,9 @@ sfConfig extends DefaultCompound; +// Daemon Display with management console +sfConfig extends DefaultManagementCompound; + // Alternative default compound with persitance pattern enabled // Uncoment next line to use it. //sfConfig extends DefaultPersistentCompound; Modified: trunk/core/smartfrog/src/org/smartfrog/services/display/WindowUtilities.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/display/WindowUtilities.java 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/display/WindowUtilities.java 2006-11-14 17:41:27 UTC (rev 3594) @@ -42,7 +42,6 @@ * Window Utilities to handle some common window and frame representation * problems * - *@deprecated 12 December 2001 */ public class WindowUtilities { /** Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java 2006-11-14 17:41:27 UTC (rev 3594) @@ -55,6 +55,8 @@ private boolean showRootProcessName = false; + private boolean isCopy = false; + /** * Constructs the DeployEntry object * @@ -62,9 +64,22 @@ * @param showRootProcessName flag indicating to show rootprocess name * @param showCDasChild flag indicating to show CD as child */ - public DeployEntry(Object entry, boolean showRootProcessName, boolean showCDasChild) { +// public DeployEntry(Object entry, boolean showRootProcessName, boolean showCDasChild) { +// this (entry,false,showRootProcessName, showCDasChild); +// } + + /** + * Constructs the DeployEntry object + * + * @param entry object entry. + * @param isCopy is entry a copy of the original object (normally when a CD is accessed remotely) + * @param showRootProcessName flag indicating to show rootprocess name + * @param showCDasChild flag indicating to show CD as child + */ + public DeployEntry(Object entry,boolean isCopy, boolean showRootProcessName, boolean showCDasChild) { try { this.entry = (Object) entry; + this.isCopy = isCopy; this.showRootProcessName = showRootProcessName; this.showCDasChild=showCDasChild; initLog(); @@ -132,6 +147,14 @@ } /** + * An entry will be a copy when access to a ComponentDescription remotely because CD does not have a remote interface + * @return is copy + */ + public boolean isCopy(){ + return isCopy; + } + + /** * Gets the root attribute of the DeployEntry object * *@return The root value @@ -144,7 +167,7 @@ return this; } if (entry instanceof Prim) { - return (new DeployEntry(((Prim) entry).sfResolveWithParser(SmartFrogCoreKeys.SF_ROOT),this.showRootProcessName,this.showCDasChild)); + return (new DeployEntry(((Prim) entry).sfResolveWithParser(SmartFrogCoreKeys.SF_ROOT),false,this.showRootProcessName,this.showCDasChild)); } //return entry; } catch (Exception ex) { @@ -371,10 +394,9 @@ try { name = e.nextElement().toString(); obj = context.get(name); - if ((isChild(obj))) { data[index][0] = name; - data[index][1] = obj2Entry(obj); + data[index][1] = obj2Entry(obj,false); index++; } } catch (Exception ex1) { @@ -732,19 +754,28 @@ * Replacement method introduced: 12-2-02 * *@param value inp object + *@param isCopy of the original object? *@return DeployEntry object */ - private DeployEntry obj2Entry(Object value) { + private DeployEntry obj2Entry(Object value, boolean isCopy) { try { boolean newShowRootProcessName = (this.showRootProcessName&&(entry instanceof ProcessCompound)); if ((value instanceof Prim)||(value instanceof ComponentDescription)) { - return (new DeployEntry(value,newShowRootProcessName,this.showCDasChild)); + return (new DeployEntry(value, isCopy, newShowRootProcessName,this.showCDasChild)); } else if (value instanceof Reference) { do { - ((Reference) value).setEager(true); + ((Reference) value).setEager(true); value = ((Prim) entry).sfResolve((Reference) value); + //Check if we are getting a copy + if (value instanceof ComponentDescription) { + Object value2 = ((Prim) entry).sfResolve((Reference) value); + if (!value.equals(value2)){ + isCopy = true; + } + sfLog().info("JULIO- Checking if we got a copy: " + isCopy); + } } while (value instanceof Reference); - return (new DeployEntry(value,newShowRootProcessName,this.showCDasChild)); + return (new DeployEntry(value,isCopy, newShowRootProcessName,this.showCDasChild)); } } catch (Exception ex) { if (sfLog().isErrorEnabled()) sfLog().error("Error building mgt info: " + ex,ex); Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreeModelSF.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreeModelSF.java 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreeModelSF.java 2006-11-14 17:41:27 UTC (rev 3594) @@ -71,13 +71,14 @@ * Constructs the DeployTreeModelSF object with the deploy entry * * @param entry deploy entry + * @param isCopy is entry a copy? * @param showRootProcessName flag indicating to show rootprocess name * @param showCDasChild flag indicating to show CD as child */ - public DeployTreeModelSF(Object entry, boolean showRootProcessName,boolean showCDasChild) { + public DeployTreeModelSF(Object entry, boolean isCopy, boolean showRootProcessName,boolean showCDasChild) { try { boolean newShowRootProcessName = (showRootProcessName&&(entry instanceof ProcessCompound)); - this.entry = new DeployEntry(entry, newShowRootProcessName,showCDasChild); + this.entry = new DeployEntry(entry, isCopy, newShowRootProcessName,showCDasChild); this.listeners = new Vector(); initLog(); //System.out.println("DeployTreeModel created"); Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreePanel.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreePanel.java 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/DeployTreePanel.java 2006-11-14 17:41:27 UTC (rev 3594) @@ -83,7 +83,7 @@ */ public DeployTreePanel() { try { - treeInit(null, false,true); + treeInit(null,false , false,true); jbInit(); } catch (Exception ex) { if (sfLog().isErrorEnabled()) sfLog().error (ex); @@ -94,13 +94,14 @@ * Constructs the DeployTreePanel object with root. * * @param root Root of the tree. + * @param isCopy is root a copy? * @param inRootPanel flag indicating to show in root panel * @param showCDasChild flag indicating to show CD as child */ - public DeployTreePanel(Object root, boolean inRootPanel,boolean showCDasChild) { + public DeployTreePanel(Object root, boolean isCopy, boolean inRootPanel,boolean showCDasChild) { try { this.inRootPanel = inRootPanel; - treeInit(root, inRootPanel,showCDasChild); + treeInit(root, isCopy , inRootPanel,showCDasChild); jbInit(); popupinit(); } catch (Exception ex) { @@ -183,13 +184,14 @@ /** * Initializes the tree. * - * @param root Root of the tree. + * @param root Root of the tree + * @param isCopy is root a copy?. * @param inRootPanel flag indicating to show in root panel * @param showCDasChild flag indicating to show CD as child */ - private void treeInit(Object root, boolean inRootPanel, boolean showCDasChild) { + private void treeInit(Object root, boolean isCopy, boolean inRootPanel, boolean showCDasChild) { if (root != null) { - treeModel = new DeployTreeModelSF(root, inRootPanel,showCDasChild); + treeModel = new DeployTreeModelSF(root, isCopy, inRootPanel,showCDasChild); } else { treeModel = new DeployTreeModelSF(); } @@ -252,9 +254,10 @@ * Sets the model attribute of the DeployTreePanel object * *@param root root of the tree + * @param isCopy is root a copy? */ - public void setModel(Object root) { - treeModel = new DeployTreeModelSF(root, inRootPanel,showCDasChild); + public void setModel(Object root, boolean isCopy) { + treeModel = new DeployTreeModelSF(root, isCopy, inRootPanel,showCDasChild); this.systemViewTree.setModel(treeModel); } Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java 2006-11-14 17:41:27 UTC (rev 3594) @@ -35,6 +35,8 @@ import org.smartfrog.sfcore.common.*; import org.smartfrog.sfcore.logging.LogSF; import org.smartfrog.sfcore.logging.LogFactory; +import org.smartfrog.sfcore.processcompound.ProcessCompound; +import org.smartfrog.sfcore.processcompound.SFProcess; import java.rmi.*; import org.smartfrog.services.display.WindowUtilities; @@ -139,8 +141,7 @@ return; } - remove((((DeployEntry) (tpath.getLastPathComponent())).getEntry()), - (String) (tempTable.getValueAt(row, 0))); + remove((((DeployEntry) (tpath.getLastPathComponent())).getEntry()), (String) (tempTable.getValueAt(row, 0))); // Entry pointed in the tree } else if (source == menuItemModifyAttribute) { @@ -201,10 +202,13 @@ if (attribute != null) { if (attribute[0] == null) { + if (sfLog().isTraceEnabled()) sfLog().trace ("No attribute to modify"); + WindowUtilities.showError(this,"No attribute to modify"); return; } if (attribute[1] == null) { if (sfLog().isErrorEnabled()) sfLog().error (" Wrong format for: " + attribute[0].toString()); + WindowUtilities.showError(this," Wrong format for: " + attribute[0].toString()); return; } @@ -312,6 +316,8 @@ if (sfLog().isErrorEnabled()) sfLog().error ("Failed to modify '"+attribName,ex); WindowUtilities.showError(this,"Failed to modify '"+attribName+"'. \n"+ex.toString()); } + } else { + WindowUtilities.showError(this,"Only Components or ComponentDescriptions can be modified"); } } /** Log for this class, created using class name*/ Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/SFDeployDisplay.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/SFDeployDisplay.java 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/SFDeployDisplay.java 2006-11-14 17:41:27 UTC (rev 3594) @@ -42,8 +42,11 @@ import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.prim.TerminationRecord; import org.smartfrog.sfcore.processcompound.SFProcess; +import org.smartfrog.sfcore.processcompound.ProcessCompound; import org.smartfrog.sfcore.common.ExitCodes; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.reference.Reference; /** @@ -272,7 +275,7 @@ JPanel deployLocalPPanel = null; if (addRootProcessPanel) { //Add rootProcessPanel - deployPanel = new DeployTreePanel(SFProcess.getRootLocator().getRootProcessCompound(InetAddress.getByName(hostname), port), true,showCDasChild); + deployPanel = new DeployTreePanel(SFProcess.getRootLocator().getRootProcessCompound(InetAddress.getByName(hostname), port), false, true,showCDasChild); deployPanel.setEnabled(true); display.tabPane.add(deployPanel, "rootProcess", indexPanel++); //Add Local Process Panel @@ -281,7 +284,7 @@ try { processName = SFProcess.getProcessCompound().sfCompleteName().toString(); } catch (Exception ex) { LogFactory.getLog("sfManagementConsole").ignore(ex);} - deployLocalPPanel = new DeployTreePanel(SFProcess.getProcessCompound(), true,showCDasChild); + deployLocalPPanel = new DeployTreePanel(SFProcess.getProcessCompound(),false, true,showCDasChild); deployLocalPPanel.setEnabled(true); display.tabPane.add(deployLocalPPanel, processName, indexPanel++); } @@ -304,7 +307,7 @@ //System.out.println("* " + key + ": " + value.toString()); if (value instanceof Prim) { if (((Prim) value).sfParent() == null) { - deployPanel = new DeployTreePanel(value, false, showCDasChild); + deployPanel = new DeployTreePanel(value,false, false, showCDasChild); deployPanel.setEnabled(true); display.tabPane.add(deployPanel, key, indexPanel++); } @@ -323,20 +326,51 @@ public synchronized void sfDeploy() throws SmartFrogException, RemoteException { // try { super.sfDeploy(); + boolean isObjCopy = false; + Object root = null; + boolean isPC = false; + String name = "Deployed System ..."; + root = sfResolve ("root",false); + if (root==null) { + // We add the new Tree component here + root = this.sfResolveWithParser(SmartFrogCoreKeys.SF_ROOT); + } + //else { + // Special case for the local process compound. sfResolve will get the remote stub - // We add the new Tree component here - Object root = this.sfResolveWithParser(SmartFrogCoreKeys.SF_ROOT); +// if (sfResolveHere("root").toString().equals("LAZY PROCESS")){ +// root = SFProcess.getProcessCompound(); +// } +// } + //} + if (root instanceof ComponentDescription) { + try { + name = ((ComponentDescription)root).sfCompleteName().toString(); + } catch (Exception ex){ sfLog().ignore(ex);} + + Object value2 = sfResolve("root",false); + if (!root.equals(value2)){ + isObjCopy = true; + } + sfLog().info("JULIO- Checking if we got a copy: " + isObjCopy); //TODO to remove when finished + } else if (root instanceof Prim) { + try { + name = ((Prim)root).sfCompleteName().toString(); + } catch (Exception ex){ sfLog().ignore(ex);} + if (root instanceof ProcessCompound){ + isPC =true; + } + } + + //root= new CompoundImpl(); //System.out.println("Root: "+root.toString()); - this.panelTree = new DeployTreePanel(root, false,true); + this.panelTree = new DeployTreePanel(root,isObjCopy, isPC,true); this.panelTree.setEnabled(true); addFrogIcon(display); - display.tabPane.add(panelTree, "Deploy Deployed System ...", 0); + display.tabPane.add(panelTree, name, 0); - this.display.screen.append("\n Version: " + - org.smartfrog.Version.versionString() + "\n"); - // Button for Refresh view ... refresh.setText("Refresh"); refresh.setActionCommand("refreshButton"); @@ -393,9 +427,23 @@ */ public void refresh() { try { + boolean isObjCopy = false; + Object root = null; + root = sfResolve ("root",false); + if (root==null) { + // We add the new Tree component here + root = this.sfResolveWithParser(SmartFrogCoreKeys.SF_ROOT); + } + + if (root instanceof ComponentDescription) { + Object value2 = sfResolve("root",false); + if (!root.equals(value2)){ + isObjCopy = true; + } + sfLog().info("JULIO- Checking if we got a copy: " + isObjCopy); + } //System.out.println("Refreshing info"); - Object root = this.sfResolve(SmartFrogCoreKeys.SF_ROOT,true); - ((DeployTreePanel) panelTree).setModel(root); + ((DeployTreePanel) panelTree).setModel(root,isObjCopy); ((DeployTreePanel) panelTree).refresh(); } catch (Throwable ex) { // Logger.logQuietly("Failure refresh() SFDeployDisplay!",ex); Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/components.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/components.sf 2006-11-14 16:40:29 UTC (rev 3593) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/components.sf 2006-11-14 17:41:27 UTC (rev 3594) @@ -26,6 +26,7 @@ // DeployManagement component DeployManagement extends Display { sfClass "org.smartfrog.services.management.SFDeployDisplay"; + // root - for the management console, by default finds ROOT. nameDisplay "SF Deploy Management Display (Exit: alt+F4 )"; //Window Title positionDisplay "NW"; //Default C. (also N, S, SE, ...) redirectStd false; //Redirect System.out,.in,.err This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2006-11-17 15:31:36
|
Revision: 3610 http://svn.sourceforge.net/smartfrog/?rev=3610&view=rev Author: julgui Date: 2006-11-17 07:31:30 -0800 (Fri, 17 Nov 2006) Log Message: ----------- Console will not allow to modify ComponentDescription that are remote SFOS-37 Modified Paths: -------------- trunk/core/smartfrog/bin/default.sf trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTree.java Modified: trunk/core/smartfrog/bin/default.sf =================================================================== --- trunk/core/smartfrog/bin/default.sf 2006-11-17 14:47:53 UTC (rev 3609) +++ trunk/core/smartfrog/bin/default.sf 2006-11-17 15:31:30 UTC (rev 3610) @@ -99,7 +99,7 @@ sfConfig extends DefaultCompound; // Daemon Display with management console -sfConfig extends DefaultManagementCompound; +// sfConfig extends DefaultManagementCompound; // Alternative default compound with persitance pattern enabled // Uncoment next line to use it. Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java 2006-11-17 14:47:53 UTC (rev 3609) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/DeployEntry.java 2006-11-17 15:31:30 UTC (rev 3610) @@ -32,6 +32,8 @@ import org.smartfrog.sfcore.prim.PrimImpl; import org.smartfrog.sfcore.reference.Reference; import org.smartfrog.sfcore.processcompound.ProcessCompound; +import org.smartfrog.sfcore.processcompound.SFProcess; + import java.rmi.RemoteException; import org.smartfrog.sfcore.componentdescription.ComponentDescription; import org.smartfrog.sfcore.logging.LogSF; @@ -83,7 +85,6 @@ this.showRootProcessName = showRootProcessName; this.showCDasChild=showCDasChild; initLog(); - //sfLog().info("DeployEntry created: "+entry+", copy: "+isCopy); } catch (Exception ex) { if (sfLog().isErrorEnabled()) sfLog().error("sfManagementConsole (DeployEntry1): "+ex.toString(),ex); } @@ -633,14 +634,15 @@ //Now every component can register with its local processCompound // and therefore it should be shown in this way. //Find ProcessCompound where entry is deployed - StringBuffer refStr = new StringBuffer(); - refStr.append("HOST \""); - refStr.append(((Prim)entry).sfDeployedHost().getCanonicalHostName()); - refStr.append("\":"); - refStr.append(((Prim)entry).sfDeployedProcessName()); - Reference refPC = Reference.fromString(refStr.toString()); +// StringBuffer refStr = new StringBuffer(); +// refStr.append("HOST \""); +// refStr.append(((Prim)entry).sfDeployedHost().getCanonicalHostName()); +// refStr.append("\":"); +// refStr.append(((Prim)entry).sfDeployedProcessName()); +// Reference refPC = Reference.fromString(refStr.toString()); // enty host - pcEntry = (ProcessCompound)((Prim)entry).sfResolve(refPC); + //pcEntry = (ProcessCompound)((Prim)entry).sfResolve(refPC); + pcEntry = SFProcess.getProcessCompound(); try { Object prim = ((Prim)entry).sfResolve( ((Prim) entry).sfCompleteName()); if (pcEntry.sfContainsValue(prim)) { @@ -768,11 +770,14 @@ private DeployEntry obj2Entry(Object value, boolean isCopy) { try { boolean newShowRootProcessName = (this.showRootProcessName&&(entry instanceof ProcessCompound)); - if ((value instanceof Prim)||(value instanceof ComponentDescription)) { + if ((value instanceof Prim)) { + return (new DeployEntry(value, false, newShowRootProcessName,this.showCDasChild)); + } + if ((value instanceof ComponentDescription)) { return (new DeployEntry(value, isCopy, newShowRootProcessName,this.showCDasChild)); } // else if (value instanceof Reference) { -// //sfLog().info("resolving reference..."); +// //sfLog().info("resolving reference..."); // do { // ((Reference) value).setEager(true); // value = ((Prim) entry).sfResolve((Reference) value); Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java 2006-11-17 14:47:53 UTC (rev 3609) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTable.java 2006-11-17 15:31:30 UTC (rev 3610) @@ -134,13 +134,15 @@ path = treePath2Path(tpath); + //System.out.println(" path "+path+", parentcopy: "+ isParentNodeACopy() +", node copy"+ isNodeACopy()+", Action: "+ e); + if (source == menuItemRemoveAttribute) { if (row == -1) { if (sfLog().isErrorEnabled()) sfLog().error("No selected Cell"); WindowUtilities.showError(this,"No selected Cell"); return; } - if (isParentNodeACopy()){ + if (isNodeACopy()){ WindowUtilities.showError(this,"The node selected is a copy and no 'remove' action can be applied\n Use a console running in the local process of this node"); return; } @@ -148,7 +150,7 @@ // Entry pointed in the tree } else if (source == menuItemModifyAttribute) { - if (isParentNodeACopy()){ + if (isNodeACopy()){ WindowUtilities.showError(this,"The node selected is a copy and no 'modify' action can be applied\n Use a console running in the local process of this node"); return; } @@ -349,5 +351,5 @@ */ private LogSF sfLog(){ return sfLog; - } + } } Modified: trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTree.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTree.java 2006-11-17 14:47:53 UTC (rev 3609) +++ trunk/core/smartfrog/src/org/smartfrog/services/management/PopUpTree.java 2006-11-17 15:31:30 UTC (rev 3610) @@ -201,6 +201,8 @@ path = treePath2Path(tpath); + //System.out.println(" path "+path+", parentcopy: "+ isParentNodeACopy() +", node copy"+ isNodeACopy()+", Action: "+ e); + //System.out.println("Tree PopUp(source): "+e.getSource()+", Path: //"+path); // Launch it @@ -310,6 +312,15 @@ Object node = (((DeployEntry) (tpath.getLastPathComponent())).getEntry()); return node; } + /** + * Get RDN Node + * @return Object + */ + public String getRDNNode() { + TreePath tpath = ((JTree) tempComp).getPathForLocation(tempX, tempY); + String nodeRDN = ((DeployEntry) (tpath.getLastPathComponent())).getRDN(); + return nodeRDN; + } public boolean isNodeACopy(){ TreePath tpath = ((JTree) tempComp).getPathForLocation(tempX, tempY); @@ -373,6 +384,11 @@ void remove() { Object obj = getNode(); + //we need to check is the parent is a copy + if (isParentNodeACopy() || getRDNNode().equals("*copy*") ) { + WindowUtilities.showError(this,"The node selected is a copy and no action can be applied\n Use a console running in the local process of this node"); + return; + } //System.out.println("remove() "+obj); if (obj instanceof ComponentDescription) { ComponentDescription cd = (ComponentDescription)obj; @@ -380,11 +396,6 @@ Prim primParent = cd.sfPrimParent(); try { if (CDparent != null) { - //we need to check is the parent is a copy - if (isParentNodeACopy() || isNodeACopy()) { - WindowUtilities.showError(this,"The node selected is a copy and no action can be applied\n Use a console running in the local process of this node"); - return; - } CDparent.sfRemoveAttribute(CDparent.sfAttributeKeyFor(cd)); } else if (primParent != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2006-11-17 15:33:39
|
Revision: 3611 http://svn.sourceforge.net/smartfrog/?rev=3611&view=rev Author: julgui Date: 2006-11-17 07:33:37 -0800 (Fri, 17 Nov 2006) Log Message: ----------- New way to load version information in ProcessCompound. Modified Paths: -------------- trunk/core/smartfrog/sf-build-version.properties trunk/core/smartfrog/src/org/smartfrog/Version.java trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFProcess.java trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf trunk/core/smartfrog/src/org/smartfrog/version.sf.build Modified: trunk/core/smartfrog/sf-build-version.properties =================================================================== --- trunk/core/smartfrog/sf-build-version.properties 2006-11-17 15:31:30 UTC (rev 3610) +++ trunk/core/smartfrog/sf-build-version.properties 2006-11-17 15:33:37 UTC (rev 3611) @@ -1,5 +1,5 @@ # SmartFrog release properties used during build process sf.majorRelease=3 sf.minorRelease=10 -sf.build=017 +sf.build=019 sf.status=dev Modified: trunk/core/smartfrog/src/org/smartfrog/Version.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/Version.java 2006-11-17 15:31:30 UTC (rev 3610) +++ trunk/core/smartfrog/src/org/smartfrog/Version.java 2006-11-17 15:33:37 UTC (rev 3611) @@ -112,7 +112,7 @@ if (!status.trim().equals("")){ newStatus=""+status; } else newStatus=""; - return name+" "+majorRelease+"."+minorRelease+"."+build+newStatus; + return name+" "+majorRelease+"."+minorRelease+"."+build+newStatus+" ("+buildDate+")"; } /** Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFProcess.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFProcess.java 2006-11-17 15:31:30 UTC (rev 3610) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFProcess.java 2006-11-17 15:33:37 UTC (rev 3611) @@ -377,8 +377,6 @@ // @TODO fix after refactoring ProcessCompound. //deployDefaultProcessDescriptions((ProcessCompound)processCompound); - processCompound.sfAddAttribute(SmartFrogCoreKeys.SF_VERSION,Version.versionString()); - return processCompound; } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf 2006-11-17 15:31:30 UTC (rev 3610) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf 2006-11-17 15:33:37 UTC (rev 3611) @@ -19,6 +19,7 @@ */ #include "org/smartfrog/components.sf" +#include "org/smartfrog/version.sf" ProcessCompoundSchema extends CompoundSchema { sfProcessJava extends OptionalString {description "name for java runtime";} @@ -55,6 +56,9 @@ // reference to root of current heirachy of processes - not necessarily a root process compound rootProcess LAZY ROOT; + + sfVersionInfo Version; + sfVersion sfVersionInfo:version; } sfConfig extends ProcessCompound; Modified: trunk/core/smartfrog/src/org/smartfrog/version.sf.build =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/version.sf.build 2006-11-17 15:31:30 UTC (rev 3610) +++ trunk/core/smartfrog/src/org/smartfrog/version.sf.build 2006-11-17 15:33:37 UTC (rev 3611) @@ -18,7 +18,8 @@ */ -Version extends { +Version extends DATA { + version ( name ++ "." ++ majorRelease ++ "." ++ minorRelease ++ "." ++ build ++ status ++ " (" ++ buildDate ++ ")" ); name "SmartFrog"; majorRelease "@majorRelease@"; minorRelease "@minorRelease@"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2006-11-29 18:55:56
|
Revision: 3676 http://svn.sourceforge.net/smartfrog/?rev=3676&view=rev Author: julgui Date: 2006-11-29 10:55:54 -0800 (Wed, 29 Nov 2006) Log Message: ----------- Add: new attribute to change font size in Display Output. Useful for demos using projectors. Modified Paths: -------------- trunk/core/smartfrog/bin/default.sf trunk/core/smartfrog/sf-build-version.properties trunk/core/smartfrog/src/org/smartfrog/services/display/Display.java trunk/core/smartfrog/src/org/smartfrog/services/display/SFDisplay.java trunk/core/smartfrog/src/org/smartfrog/services/display/components.sf Modified: trunk/core/smartfrog/bin/default.sf =================================================================== --- trunk/core/smartfrog/bin/default.sf 2006-11-29 16:41:49 UTC (rev 3675) +++ trunk/core/smartfrog/bin/default.sf 2006-11-29 18:55:54 UTC (rev 3676) @@ -40,6 +40,7 @@ DefaultDisplay extends Display { nameDisplay "sfDaemon Display"; // Window Title positionDisplay "NE"; // Window position: North-West + fontSize 12; // Display font size redirectStd true; // Redirect std output and error to this wind. showIP true; // Show IP address in window title showSfProcess true; // Show sfProcess name in window title @@ -55,6 +56,7 @@ terminateSFProcessOnExit true; // Terminates sfDaemon when window is closed widthDisplay 800; heightDisplay 600; + fontSize 12; // Display font size root LAZY PROCESS; } Modified: trunk/core/smartfrog/sf-build-version.properties =================================================================== --- trunk/core/smartfrog/sf-build-version.properties 2006-11-29 16:41:49 UTC (rev 3675) +++ trunk/core/smartfrog/sf-build-version.properties 2006-11-29 18:55:54 UTC (rev 3676) @@ -1,5 +1,5 @@ # SmartFrog release properties used during build process sf.majorRelease=3 sf.minorRelease=10 -sf.build=027 +sf.build=029 sf.status=dev Modified: trunk/core/smartfrog/src/org/smartfrog/services/display/Display.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/display/Display.java 2006-11-29 16:41:49 UTC (rev 3675) +++ trunk/core/smartfrog/src/org/smartfrog/services/display/Display.java 2006-11-29 18:55:54 UTC (rev 3676) @@ -241,6 +241,7 @@ private boolean systemExit = true; Display mngConsole = null; private JMenuItem jMenuItemMngConsole = new JMenuItem(); + private int fontSize = 12; /** * Constructs Display object with title. @@ -1316,7 +1317,7 @@ screen.setBackground(NONEDITCOLOR); screen.setForeground(SystemColor.text); screen.addKeyListener(this); - screen.setFont(new java.awt.Font("DialogInput", 0, 12)); + setFontSize(fontSize); mainToolBar.setBorder(BorderFactory.createEtchedBorder()); mainToolBar.setDoubleBuffered(true); @@ -1413,6 +1414,19 @@ mainToolBar.add(stopResume, null); } + public void setFontSize(int fontSize) { + screen.setFont(new java.awt.Font("DialogInput", 0, fontSize)); + } + + public void increaseFontSize() { + screen.setFont(new java.awt.Font("DialogInput", 0, screen.getFont().getSize()+1)); + } + + public void reduceFontSize() { + if (screen.getFont().getSize()>1) + screen.setFont(new java.awt.Font("DialogInput", 0, screen.getFont().getSize()-1)); + } + public void setAskSaveChanges(boolean askSaveChanges){ jCheckBoxMenuItemAskSaveChanges.setSelected(askSaveChanges); } Modified: trunk/core/smartfrog/src/org/smartfrog/services/display/SFDisplay.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/display/SFDisplay.java 2006-11-29 16:41:49 UTC (rev 3675) +++ trunk/core/smartfrog/src/org/smartfrog/services/display/SFDisplay.java 2006-11-29 18:55:54 UTC (rev 3676) @@ -73,6 +73,8 @@ private static final String HEIGHT_DISPLAY = "heightDisplay"; /** String name for attribute widthDisplay. */ private static final String WIDTH_DISPLAY = "widthDisplay"; + /** String name for attribute widthDisplay. */ + private static final String FONTSIZE_DISPLAY = "fontSize"; /** String name for attribute formatMsg. */ private static final String FORMAT_MSG = "formatMsg"; /** String name for attribute externalPrinter. */ @@ -102,6 +104,8 @@ private int height = 400; /** Definition of component attribute - width. */ private int width = 500; + /** Definition of component attribute - fontSize @value. */ + private int fontSize = 12; /** Definition of component attribute - PrintnMsgInt. */ private PrintMsgInt printMsgImp = null; /** Definition of component attribute - havePrinter. */ @@ -189,6 +193,7 @@ display = new Display(nameDisplay, this, null); display.setVisible(false); display.setSize(width, height); + display.setFontSize(fontSize); display.setTextScreen(text); setPositionDisplay(positionDisplay, display); display.setVisible(true); @@ -268,6 +273,9 @@ attribToRead = WIDTH_DISPLAY; width = sfResolve(WIDTH_DISPLAY, width, false); + attribToRead = FONTSIZE_DISPLAY; + fontSize = sfResolve(FONTSIZE_DISPLAY, fontSize, false); + attribToRead = SCREEN_EDITABLE; screenEditable = sfResolve(SCREEN_EDITABLE,screenEditable, false); Modified: trunk/core/smartfrog/src/org/smartfrog/services/display/components.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/display/components.sf 2006-11-29 16:41:49 UTC (rev 3675) +++ trunk/core/smartfrog/src/org/smartfrog/services/display/components.sf 2006-11-29 18:55:54 UTC (rev 3676) @@ -33,6 +33,7 @@ //screenEditable true; //Editable? heightDisplay 400; widthDisplay 500; + fontSize 12; //formatMsg false; // Add date to every printed msg! Not to outputStreams. Ex. [21:44:10.934 16/12/01] msg autoClean false; // Should auto clean the screen? autoSave false; // Should save screen content before cleaning it? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2006-12-07 16:45:31
|
Revision: 3698 http://svn.sourceforge.net/smartfrog/?rev=3698&view=rev Author: steve_l Date: 2006-12-07 08:43:43 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Conditionals (if and waitfor) appear to work Modified Paths: -------------- trunk/core/smartfrog/docs/sfWorkflow.sxw trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Sequence.java trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/delay.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/during.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/firebreak.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/sequence.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/WaitForImpl.java Modified: trunk/core/smartfrog/docs/sfWorkflow.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/TestCompoundImpl.java 2006-12-07 16:43:43 UTC (rev 3698) @@ -28,6 +28,7 @@ import org.smartfrog.sfcore.workflow.eventbus.EventCompoundImpl; import org.smartfrog.sfcore.workflow.combinators.DelayedTerminator; import org.smartfrog.sfcore.utils.ComponentHelper; +import org.smartfrog.sfcore.utils.ShouldDetachOrTerminate; import org.smartfrog.sfcore.componentdescription.ComponentDescription; import java.rmi.RemoteException; @@ -44,8 +45,9 @@ private ComponentDescription tests; private Prim testsPrim; - protected static final String ACTION_RUNNING = "action"; - protected static final String TESTS_RUNNING = "_testsRunning"; + protected static final String ACTION_RUNNING = ATTR_ACTION; + protected static final String TESTS_RUNNING = ATTR_TESTS; + protected static final String TEARDOWN_RUNNING = ATTR_TEARDOWN; private long undeployAfter; private long testTimeout; private boolean expectTerminate; @@ -67,12 +69,21 @@ */ public static final String FORCED_TERMINATION = "timed shutdown of test components"; public static final String TEST_FAILED_WRONG_STATUS = "Expected action to terminate with the status "; - protected static final String TEARDOWN_RUNNING = "_teardownRunning"; + private boolean shouldTerminate; public TestCompoundImpl() throws RemoteException { } + /** + * {@inheritDoc} + * @return false + */ + protected boolean isOldNotationSupported() { + return false; + } + + /** * Deploys and reads the basic configuration of the component. * Overrides EventCompoundImpl.sfDeploy. * @@ -96,6 +107,7 @@ expectTerminate = sfResolve(ATTR_EXPECT_TERMINATE, false, true); exitType = sfResolve(ATTR_EXIT_TYPE, exitType, true); exitText = sfResolve(ATTR_EXIT_TEXT, exitText, true); + shouldTerminate = sfResolve(ShouldDetachOrTerminate.ATTR_SHOULD_TERMINATE,true,true); } public synchronized void sfStart() throws SmartFrogException, RemoteException { @@ -221,11 +233,11 @@ * @return true if the termination event is to be forwarded up the chain. */ protected boolean onChildTerminated(TerminationRecord childStatus, Prim child) { - boolean terminate =true; + boolean terminate = shouldTerminate; boolean tearDownTime=false; TerminationRecord error=null; if (actionPrim == child) { - if (actionTerminator.isForcedShutdown() && expectTerminate == false) { + if (actionTerminator.isForcedShutdown() && !expectTerminate) { //this is a forced shutdown, all is well sfLog().info("Graceful shutdown of test components"); } else { @@ -236,15 +248,13 @@ //we have a match sfLog().debug("Exit type is as expected"); expected = true; - if (exitText != null) { + if (exitText != null && exitText.length()>0) { String description = childStatus.description; if (description == null) { description = ""; } - if (description.indexOf(exitText) >= 0) { - expected &= true; - } else { + if (description.indexOf(exitText) < 0) { sfLog().debug("Exit text mismatch"); expected=false; } Modified: trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/services/assertions/testcomponents.sf 2006-12-07 16:43:43 UTC (rev 3698) @@ -111,6 +111,8 @@ sfShouldTerminate true; description ""; + action extends Compound; + //default to one minute undeployAfter 60000; //no delay by default Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Sequence.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Sequence.java 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/Sequence.java 2006-12-07 16:43:43 UTC (rev 3698) @@ -30,6 +30,7 @@ import org.smartfrog.sfcore.prim.TerminationRecord; import org.smartfrog.sfcore.workflow.eventbus.EventCompoundImpl; import org.smartfrog.sfcore.common.*; +import org.smartfrog.sfcore.utils.ComponentHelper; /** * Sequence is a modified compound which differs in that the sub-components @@ -79,15 +80,12 @@ * the component */ public synchronized void sfStart() throws SmartFrogException, RemoteException { - super.sfStart(); + super.sfStart(); + if(actionKeys.hasMoreElements()) { // let any errors be thrown and caught by SmartFrog for abnormal // termination - including empty actions String componentName; - try { - componentName = (String)actionKeys.nextElement(); - } catch (java.util.NoSuchElementException nex){ - throw new SmartFrogRuntimeException ("Empty actions",this); - } + componentName = (String)actionKeys.nextElement(); ComponentDescription act =null; try { act = (ComponentDescription) actions.get(componentName); @@ -101,6 +99,13 @@ + componentName +" in " +sfCompleteNameSafe() ,ex); } } + } else { + //nothing in the sequence, so just terminate ourselves + new ComponentHelper(this).sfSelfDetachAndOrTerminate(TerminationRecord.NORMAL, + "Empty Sequence", + null, + null); + } } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/delay.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/delay.sf 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/delay.sf 2006-12-07 16:43:43 UTC (rev 3698) @@ -26,8 +26,6 @@ //delay in milliseconds time extends Integer; } - // action ... - //delay in milliseconds time 0; } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/during.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/during.sf 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/during.sf 2006-12-07 16:43:43 UTC (rev 3698) @@ -32,6 +32,5 @@ /** * initial time is zero */ - time 0; } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/firebreak.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/firebreak.sf 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/firebreak.sf 2006-12-07 16:43:43 UTC (rev 3698) @@ -29,5 +29,4 @@ */ FireBreak extends Parallel { sfClass "org.smartfrog.sfcore.workflow.combinators.FireBreak"; - //actions extends LAZY {} } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/sequence.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/sequence.sf 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/combinators/sequence.sf 2006-12-07 16:43:43 UTC (rev 3698) @@ -26,10 +26,12 @@ * combinator creates no subcomponents until it's sfStart phase at which point * the first mentioned sub-components is created in the normal way. The * Sequence combinator waits for each of its sub-components to terminate at - * which point it starts the next. When teh last terminates normally it too + * which point it starts the next. When the last child terminates normally it too * terminates normally. If an error occurs at any point, or a sub-component * terminates abnormally, the Sequence combinator does too. */ Sequence extends ActionsCompound { sfClass "org.smartfrog.sfcore.workflow.combinators.Sequence"; + //control action on an empty deployment + sfShouldTerminate true; } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/WaitForImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/WaitForImpl.java 2006-12-07 16:10:45 UTC (rev 3697) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/WaitForImpl.java 2006-12-07 16:43:43 UTC (rev 3698) @@ -34,7 +34,7 @@ private long interval; private long timeout; private long end; - private Prim action; + private Thread thread; public WaitForImpl() throws RemoteException { @@ -54,10 +54,28 @@ timeout = sfResolve(ATTR_INTERVAL, interval, true); //pick on the current start time. end=System.currentTimeMillis()+timeout; + thread = new Thread(this); + thread.start(); } /** + * Handle notifications of termination + * + * @param status termination status of sender + * @param comp sender of termination + */ + public void sfTerminatedWith(TerminationRecord status, Prim comp) { + super.sfTerminatedWith(status, comp); + //stop the waiting + synchronized(this) { + if(thread!=null) { + thread.interrupt(); + } + } + } + + /** * When an object implementing interface <code>Runnable</code> is used * to create a thread, starting the thread causes the object's * <code>run</code> method to be called in that separately executing @@ -70,35 +88,42 @@ */ public void run() { - Throwable fault=null; try { - boolean timedout = false; - boolean test; - test = evaluate(); - while(!test && !timedout) { - Thread.sleep(interval); + Throwable fault=null; + try { + boolean timedout = false; + boolean test; test = evaluate(); - timedout = System.currentTimeMillis() < end; + while(!test && !timedout) { + Thread.sleep(interval); + test = evaluate(); + timedout = System.currentTimeMillis() > end; + } + //we have either timed out or the test has passed. + //chose the branch to test + String branch=test?ATTR_THEN:ATTR_ELSE; + Prim prim = deployChildCD(branch, false); + //then finish if we did not deploy anything + if(prim==null) { + finish(); + } + } catch (RemoteException e) { + fault=e; + } catch (SmartFrogException e) { + fault = e; + } catch (InterruptedException e) { + //we have been interrupted, which implies terminated. + //Do nothing } - //we have either timed out or the test has passed. - //chose the branch to test - String branch=test?ATTR_THEN:ATTR_ELSE; - Prim prim = deployChildCD(branch, false); - //then finish if we did not deploy anything - if(prim==null) { - finish(); + if(fault!=null) { + //trouble -fail + sfTerminate(TerminationRecord.abnormal("Trouble during WaitFor",name,fault)); } - } catch (RemoteException e) { - fault=e; - } catch (SmartFrogException e) { - fault = e; - } catch (InterruptedException e) { - fault = e; + } finally { + synchronized (this) { + thread=null; + } } - if(fault!=null) { - //trouble -fail - sfTerminate(TerminationRecord.abnormal("Trouble during WaitFor",name,fault)); - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2006-12-15 18:40:00
|
Revision: 3726 http://svn.sourceforge.net/smartfrog/?rev=3726&view=rev Author: julgui Date: 2006-12-15 10:39:56 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Bug fix: support to bind the daemon (registry) to a particular IpAddress. @TODO: shell scripts sfStart/sfTerminate/... don't work with new code yet (when defining a particular port) Need to update locator in the rest of the system. SFOS-54 Modified Paths: -------------- trunk/core/smartfrog/bin/default.ini trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/DefaultRootLocatorImpl.java trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocket.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocketFactory.java Added Paths: ----------- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFServerSocketFactory.java Modified: trunk/core/smartfrog/bin/default.ini =================================================================== --- trunk/core/smartfrog/bin/default.ini 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/bin/default.ini 2006-12-15 18:39:56 UTC (rev 3726) @@ -7,6 +7,8 @@ # SmartFrog daemon connection port # org.smartfrog.sfcore.processcompound.sfRootLocatorPort=3800 +# SmartFrog daemon bind port +# org.smartfrog.sfcore.processcompound.sfRootLocatorBindAddress=localhost # Liveness check period (in seconds) # org.smartfrog.sfcore.processcompound.sfLivenessDelay=15 Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -63,6 +63,12 @@ * Value {@value} */ public final static String SF_ROOT_LOCATOR_PORT = "sfRootLocatorPort"; + /** + * Registry bind adderess used by the rootProcess daemon. + * + * Value {@value} + */ + public final static String SF_ROOT_LOCATOR_BIND_ADDRESS = "sfRootLocatorBindAddress"; /** * Attribute with garbage collection time out for SubProcesses. Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/DefaultRootLocatorImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/DefaultRootLocatorImpl.java 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/DefaultRootLocatorImpl.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -21,6 +21,7 @@ package org.smartfrog.sfcore.processcompound; import java.net.InetAddress; +import java.net.UnknownHostException; import java.rmi.RemoteException; import java.rmi.registry.Registry; @@ -30,6 +31,7 @@ import org.smartfrog.sfcore.common.SmartFrogException; import org.smartfrog.sfcore.common.SmartFrogRuntimeException; import org.smartfrog.sfcore.common.SmartFrogResolutionException; +import org.smartfrog.sfcore.common.SFNull; import org.smartfrog.sfcore.security.SFSecurity; /** @@ -120,6 +122,9 @@ /** Port for registry. */ protected static int registryPort = -1; + /** Port for registry. */ + protected static InetAddress registryBindAddr = null; + /** RMI Registry. */ protected static Registry registry = null; @@ -166,7 +171,49 @@ return registryPort; } + /** + * Gets the bind address for RMI registry on which input process compound is running or + * if ProcessCompound is null then the 'sfRootLocatorPort' is read from + * processcompound.sf description + * + * @param c Instance of process compound + * + * @return InetAddress bind address or <code>null</code> if no particular one is defined. + * + * @throws SmartFrogException fails to get the registry bind address + * @throws RemoteException In case of network/rmi error + */ + protected static InetAddress getRegistryBindAddress(ProcessCompound c) + throws SmartFrogException, RemoteException { + Object bindAddr=null; + try { + if (registryBindAddr == null) { + if (c!=null) { + bindAddr = (c.sfResolveHere(SmartFrogCoreKeys.SF_ROOT_LOCATOR_BIND_ADDRESS, false)); + } else { + bindAddr = SFProcess.getProcessCompoundDescription().sfResolveHere(SmartFrogCoreKeys. + SF_ROOT_LOCATOR_BIND_ADDRESS, false); + } + if ((bindAddr==null) ||(bindAddr instanceof SFNull)) { + return null; + } else if (bindAddr instanceof java.net.InetAddress) { + return ((java.net.InetAddress) bindAddr); + } else { + registryBindAddr = InetAddress.getByName(bindAddr.toString()); + } + } + } catch (UnknownHostException uhex){ + throw new SmartFrogResolutionException( + "Wrong binding address for "+SmartFrogCoreKeys.SF_ROOT_LOCATOR_PORT + +": "+bindAddr+", "+bindAddr.getClass().getName()+"", uhex, c); + + } + return registryBindAddr; + } + + + /** * Tries to make the requesting process compound the root of the entire * host. This might fail since another process compound has already done * this. @@ -182,10 +229,11 @@ throws SmartFrogException, RemoteException { registryPort = getRegistryPort(c); + registryBindAddr = getRegistryBindAddress(c); try { if (registry==null) { - registry = SFSecurity.createRegistry(registryPort); + registry = SFSecurity.createRegistry(registryPort,registryBindAddr); } //registry.bind(defaultName, c); /** Added: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFServerSocketFactory.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFServerSocketFactory.java (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFServerSocketFactory.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -0,0 +1,83 @@ +/** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +For more information: www.smartfrog.org + +*/ + +package org.smartfrog.sfcore.processcompound; + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.InetAddress; +import java.rmi.server.RMIServerSocketFactory; + + +/** + * A server socket factory that adapts a server socket factory so that we can bind to a particular ip address and + * can be used to generate RMI server sockets. + * + */ +public class SFServerSocketFactory implements RMIServerSocketFactory { + + + private final InetAddress bindAddr; + + public int hashCode() { + return bindAddr.hashCode(); + } + public boolean equals(Object obj) { + if (obj == this) { + return true; + } else if (obj == null || getClass() != obj.getClass()) { + return false; + } + SFServerSocketFactory other = (SFServerSocketFactory) obj; + return bindAddr.equals(other.bindAddr); + } + + + /** + * Constructs SFServerSocketFactory with security environment. + * <P> + * If the bind address is <code>null</code>, then the system will pick up + * an ephemeral port and a valid local address to bind the socket. + * <P> + * @param bindAddr bind address for the server socket + * + */ + public SFServerSocketFactory(InetAddress bindAddr) { + this.bindAddr = bindAddr; + } + + /** + * Create a server socket on the specified port (port 0 indicates an + * anonymous port). + * + * @param port The port number + * + * @return The server socket in the specified port + * + * @throws IOException Cannot create server socket. + */ + public ServerSocket createServerSocket(int port) throws IOException { + /* We just configure the final socket and not this server socket, + * for this reason we don't need a SSLServerSocketFactory. + * However, we have to wrap it to pass the security + * context. */ + return new ServerSocket(port, 0, bindAddr); + } +} Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/processcompound.sf 2006-12-15 18:39:56 UTC (rev 3726) @@ -27,6 +27,7 @@ sfProcessAllow extends OptionalBoolean {description "decides if subprocesses are allowed in root process";} sfProcessTimeout extends OptionalInteger {description "timeout for subprocess deployment in seconds";} sfRootLocatorPort extends Integer {description "root locator port for SmartFrog";} + sfRootLocatorBindAddress extends Optional {description "root locator bind address for SmartFrog";} sfRootLocatorClass extends OptionalString {description "class that implements root locator";} } @@ -54,6 +55,8 @@ sfRootLocatorPort 3800; + //sfRootLocatorBindAddress "localhost"; //by default not defined + // reference to root of current heirachy of processes - not necessarily a root process compound rootProcess LAZY ROOT; Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -25,6 +25,8 @@ import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.RMISocketFactory; +import java.net.InetAddress; +import org.smartfrog.sfcore.processcompound.SFServerSocketFactory; /** @@ -44,7 +46,10 @@ /** A security environment shared by all the local SF components */ private static SFSecurityEnvironment securityEnv; + /** A RMIServerSocketFactory used when security is ff */ + private static SFServerSocketFactory nonSecServerSocketFactory; + /** * Initializes the security using system properties to decide on the level * of security required. @@ -69,7 +74,7 @@ Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider()); */ - securityEnv = new SFSecurityEnvironmentImpl(); + securityEnv = new SFSecurityEnvironmentImpl(null); /*Make sure that we restrict downloading of stubs/RMIClientFactory Note that this only works if this is called before RMI @@ -164,13 +169,15 @@ * * @since JDK1.1 */ - public static Registry createRegistry(int port) throws RemoteException { + public static Registry createRegistry(int port, InetAddress bindAddr) throws RemoteException { + System.out.println("Binding to "+bindAddr); if (isSecurityOn()) { return LocateRegistry.createRegistry(port, securityEnv.getEmptyRMIClientSocketFactory(), securityEnv.getRMIServerSocketFactory()); } else { - return LocateRegistry.createRegistry(port); + nonSecServerSocketFactory = new SFServerSocketFactory(bindAddr); + return LocateRegistry.createRegistry(port,null,nonSecServerSocketFactory); } } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -26,6 +26,7 @@ import java.rmi.server.RMISocketFactory; import java.security.KeyStore; import java.security.cert.Certificate; +import java.net.InetAddress; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; @@ -80,24 +81,32 @@ /** A RMI wrapper factory to the server's SSL factory. */ private RMIServerSocketFactory rmissf; + /** Binding Address for RMIServerSocketFactory */ + private InetAddress rmissfBindAddr=null; + /** A RMI wrapper factory to the client's and server's SSL factories. */ private RMISocketFactory rmisf; /** A debugging utility to print messages. */ private SFDebug debug; + /** * Constructs SFSecurityEnvironmentImpl. Initializes key store, key * managers,trust managers, contexts, SSL socket factories and RMI socket * factories - * + * <p> + * If the bind address is <code>null</code>, then the system will pick up + * an ephemeral port and a valid local address to bind the socket. + * <P> + * @param bindAddr bind address * @throws SFGeneralSecurityException if error during initalization */ - public SFSecurityEnvironmentImpl() throws SFGeneralSecurityException { + public SFSecurityEnvironmentImpl(InetAddress bindAddr) throws SFGeneralSecurityException { // Init debugging. debug = SFDebug.getInstance("SFSecurityEnvironmentImpl"); - + this.rmissfBindAddr = bindAddr; // Check that requests comes from trusted code. SFSecurity.checkSFCommunity(); @@ -216,7 +225,7 @@ */ private void initRMISocketFactories() throws SFGeneralSecurityException { rmicsf = new SFClientSocketFactory(this); - rmissf = new SFServerSocketFactory(this); + rmissf = new SFServerSocketFactory(rmissfBindAddr,this); rmisf = new SFRMISocketFactory(rmicsf, rmissf); } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocket.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocket.java 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocket.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -23,6 +23,7 @@ import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; +import java.net.InetAddress; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; @@ -43,16 +44,20 @@ /** * Class Constructor. - * + * <P> + * If the bind address is <code>null</code>, then the system will pick up + * an ephemeral port and a valid local address to bind the socket. + * <P> + * @param bindAddr bind address * @param port The port number * @param secEnv A security environment that handles the configuration of * sockets. * * @throws IOException In case error while creating server socket */ - public SFServerSocket(int port, SFSecurityEnvironment secEnv) + public SFServerSocket(int port, InetAddress bindAddr, SFSecurityEnvironment secEnv) throws IOException { - super(port); + super(port,0,bindAddr); this.secEnv = secEnv; debug = SFDebug.getInstance("SFServerSocket"); } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocketFactory.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocketFactory.java 2006-12-15 18:34:49 UTC (rev 3725) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFServerSocketFactory.java 2006-12-15 18:39:56 UTC (rev 3726) @@ -22,6 +22,7 @@ import java.io.IOException; import java.net.ServerSocket; +import java.net.InetAddress; import java.rmi.server.RMIServerSocketFactory; @@ -34,13 +35,35 @@ /** A security environment that handles the configuration of sockets. */ private SFSecurityEnvironment secEnv; + private final InetAddress bindAddr; + + public int hashCode() { + return bindAddr.hashCode(); + } + public boolean equals(Object obj) { + if (obj == this) { + return true; + } else if (obj == null || getClass() != obj.getClass()) { + return false; + } + SFServerSocketFactory other = (SFServerSocketFactory) obj; + return bindAddr.equals(other.bindAddr); + } + + /** * Constructs SFServerSocketFactory with security environment. + * <P> + * If the bind address is <code>null</code>, then the system will pick up + * an ephemeral port and a valid local address to bind the socket. + * <P> + * @param bindAddr bind address for the server socket * * @param secEnv A security environment that handles the configuration of * sockets. */ - public SFServerSocketFactory(SFSecurityEnvironment secEnv) { + public SFServerSocketFactory(InetAddress bindAddr, SFSecurityEnvironment secEnv) { + this.bindAddr = bindAddr; this.secEnv = secEnv; } @@ -59,6 +82,6 @@ * for this reason we don't need a SSLServerSocketFactory. * However, we have to wrap it to pass the security * context. */ - return new SFServerSocket(port, secEnv); + return new SFServerSocket(port, bindAddr, secEnv); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2006-12-21 15:59:05
|
Revision: 3744 http://svn.sourceforge.net/smartfrog/?rev=3744&view=rev Author: steve_l Date: 2006-12-21 07:58:57 -0800 (Thu, 21 Dec 2006) Log Message: ----------- remove dependency on javacc to avoid things breaking, force load ivy Modified Paths: -------------- trunk/core/smartfrog/build.xml trunk/core/smartfrog/ivy.xml Modified: trunk/core/smartfrog/build.xml =================================================================== --- trunk/core/smartfrog/build.xml 2006-12-20 13:33:09 UTC (rev 3743) +++ trunk/core/smartfrog/build.xml 2006-12-21 15:58:57 UTC (rev 3744) @@ -817,7 +817,14 @@ <target name="ivy-init" depends="init,target-names" > <property name="ivy.dir" location="${build.extra.dir}/ivy" /> <property name="ivy.lib.dir" location="${ivy.dir}/lib" /> + <property name="ivy.version" value="1.4.1" /> <property name="ivy.reports.dir" location="${build.dir}/ivy/reports"/> + <typedef uri="antlib:fr.jayasoft.ivy.ant" onerror="fail" + resource="fr/jayasoft/ivy/ant/antlib.xml"> + <classpath> + <pathelement location="../antbuild/ivy/lib/ivy-${ivy.version}.jar"/> + </classpath> + </typedef> <ivy:configure file="ivyconf.xml"/> </target> Modified: trunk/core/smartfrog/ivy.xml =================================================================== --- trunk/core/smartfrog/ivy.xml 2006-12-20 13:33:09 UTC (rev 3743) +++ trunk/core/smartfrog/ivy.xml 2006-12-21 15:58:57 UTC (rev 3744) @@ -43,7 +43,8 @@ <dependencies> <!--javacc is used for the javacc task--> - <dependency org="net.java.dev.javacc" name="javacc" rev="3.2" - conf="javacc->default"/> + <!--<dependency org="net.java.dev.javacc" name="javacc" rev="3.2"--> + <!--conf="javacc->default"/>--> + <!----> </dependencies> </ivy-module> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-01-18 13:56:08
|
Revision: 3814 http://svn.sourceforge.net/smartfrog/?rev=3814&view=rev Author: steve_l Date: 2007-01-18 05:54:23 -0800 (Thu, 18 Jan 2007) Log Message: ----------- Big reordering of the targets to create release artifacts. This is an transient step towards having ivy in charge of making releases Modified Paths: -------------- trunk/core/smartfrog/buildRelease.xml trunk/core/smartfrog/releaseBuild.xml Modified: trunk/core/smartfrog/buildRelease.xml =================================================================== --- trunk/core/smartfrog/buildRelease.xml 2007-01-16 15:37:37 UTC (rev 3813) +++ trunk/core/smartfrog/buildRelease.xml 2007-01-18 13:54:23 UTC (rev 3814) @@ -43,9 +43,8 @@ <tstamp/> <property name="Name.Framework" value="SmartFrog Framework"/> <property name="Name.System" value="SmartFrog"/> - <property name="Name.Company" value="(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP"/> - <!--property name="version" value="3.04.014.beta"/--> - <property name="year" value="2005"/> + <property name="year" value="2007"/> + <property name="Name.Company" value="(C) Copyright 1998-2007 Hewlett-Packard Development Company, LP"/> <echo message=""/> <echo message="==================================================================="/> @@ -127,48 +126,148 @@ <!-- Global properties --> <!-- =================================================================== --> <!-- Release Directories --> - <property name="bin" value="bin"/> <!-- where the source is --> - <property name="src" value="src"/> <!-- where the source is --> - <property name="dist" value="dist"/> <!-- where the files to zip go --> - <property name="releases" value="releases"/> <!-- where the dated zips go, don't clean --> - <property name="lib" value="lib"/> - <property name="docs" value="docs"/> - <property name="examples" value="examples"/> - <property name="examplesSrc" value="src"/> - <property name="dist.lib.dir" location="${dist}/${lib}"/> + <property name="bin" value="bin"/> + <!-- where the source is --> + <property name="src" value="src"/> + <!-- where the source is --> + <property name="dist" value="dist"/> + <!-- where the files to zip go --> + <property name="release.dir" location="../releases" /> + <property name="release.unzip.dir" location="../releases/expanded" /> - <property name="examplesFiles" value="org/smartfrog/examples/**/*"/> +the <!-- where the dated zips go, don't clean --> + <property name="lib" value="lib"/> + <property name="docs" value="docs"/> + <property name="examples" value="examples"/> + <property name="examplesSrc" value="src"/> + <property name="dist.lib.dir" location="${dist}/${lib}"/> + <property name="dist.bin.dir" location="${dist}/${bin}"/> - <property name="unix-executables" value="**/*.sh,**/*.pl,**/*.py" /> - <property name="dos-executables" value="**/*.bat,**/*.cmd" /> - <property name="default" value="**/default*" /> - <property name="smartfrogdoc" value="smartfrogdoc"/> + <property name="examplesFiles" value="org/smartfrog/examples/**/*"/> + + <property name="default" value="**/default*"/> + <property name="smartfrogdoc" value="smartfrogdoc"/> + + <!--mode for executable files in the archives--> + <property name="exec" value="755" /> + <!-- properties for executables--> + <property name="dos-executables" value="**/*.bat,**/*.cmd"/> + + <!-- =================================================================== --> + <!-- define the patterns for different parts of the archives --> + <!-- patterns are not bound to a specific directory, so can be reused --> + <!-- and can be declared before the artifacts actually exist, unlike filesets--> + <!-- =================================================================== --> + <patternset id="excluded.cruft"> + <!-- because some versions of svn-on-windws downt use the .svn dir, and only Ant1.7+ knows that --> + <exclude name="**/SVN" /> + <exclude name="**/svn" /> + <exclude name="**/*.dfPackage" /> + <exclude name="**/Cvs" /> + <exclude name="**/CVS" /> + <exclude name="**/.#*" /> + <exclude name="**/*.*~" /> + </patternset> + + <!--Shell scripts from the bin/ directories--> + <patternset id="unix.bin"> + <include name="smartfrog"/> + <include name="sf*"/> + <include name="*.pl"/> + <include name="*.py"/> + <exclude name="*.bat"/> + <exclude name="*.cmd"/> + <patternset refid="excluded.cruft"/> + </patternset> + + <!--everything in the bin dir other than the unix stuff--> + <patternset id="other.bin"> + <include name="*"/> + <exclude name="smartfrog"/> + <exclude name="sf*"/> + <exclude name="*.pl"/> + <exclude name="*.py"/> + <patternset refid="excluded.cruft"/> + </patternset> + + <!-- pattern for documentation; can be applied to doc/ and dist/doc--> + <patternset id="docs.pattern"> + <include name="dir.JPG"/> + <include name="*.html"/> + <include name="*.pdf"/> + <include name="jedit-smartfrog.pdf"/> + <include name="antTasksManual/*.html"/> + <include name="components/*.pdf"/> + <include name="images/**"/> + <include name="jdocs/**"/> + <include name="skin/**"/> + <include name="smartfrogdoc/**"/> + <patternset refid="excluded.cruft"/> + </patternset> + + <!--directories that security needs --> + <patternset id="security.pattern"> + <include name="private/**"/> + <include name="testCA/**"/> + <patternset refid="excluded.cruft"/> + </patternset> + + <!--all the source files.--> + <patternset id="source.pattern"> + <include name="src/**"/> + <include name="private/**"/> + <include name="testCA/**"/> + <include name="javacc/*"/> + <include name="build.xml"/> + <include name="releaseBuild.xml"/> + <include name="parsertargets"/> + <include name="COPYRIGHT.txt"/> + <include name="LICENSE.txt"/> + <include name="changes.txt"/> + <include name="readme.txt"/> + <include name="sf-build-version.properties"/> + <!-- ISSUE: what use are these? --> + <include name="../testharness/build.xml"/> + <include name="../testharness/testcases/build.xml"/> + <patternset refid="excluded.cruft"/> + </patternset> + + <patternset id="lib.pattern"> + <include name="lib/**/*.jar"/> + </patternset> + + + <target name="clean" > + <delete dir="${release.dir}" /> + </target> + <!-- =================================================================== --> <!-- FixCRLF for different platforms --> <!-- =================================================================== --> <target name="fixCRLF"> <!-- OS dependant --> - <fixcrlf srcdir="${dist}/${bin}" + <fixcrlf srcdir="${dist.bin.dir}" includes="**/**" - excludes="${dos-executables},${windows-executables},${default}" + excludes="${dos-executables},${default}" /> - <!-- OS dependant --> - <fixcrlf srcdir="${dist}/${bin}" - tab="remove" - tablength="4" - includes="${default}" - /> - <!-- Windows/Dos format --> - <fixcrlf srcdir="${dist}/${bin}" - eol="crlf" - includes="${dos-executables}" - /> - <!-- Unix format --> - <fixcrlf srcdir="${dist}/${bin}" - eol="lf" - includes="${unix-executables}" - /> + <!-- recursively set all batch files to DOS--> + <fixcrlf srcdir="${dist.bin.dir}" eol="dos" + tab="remove" + tablength="4" + includes="${dos-executables}" + /> + <!-- set the shell scripts to unix and executable--> + <fixcrlf srcdir="${dist.bin.dir}" + eol="unix" eof="remove" + tab="remove" + tablength="4" + > + <patternset refid="unix.bin"/> + </fixcrlf> + <chmod dir="${dist.bin.dir}" perm="ugo+rx" > + <patternset refid="unix.bin"/> + </chmod> <!-- OS dependant --> <fixcrlf srcdir="${dist}" @@ -181,15 +280,15 @@ <!-- =================================================================== --> <target name="initrelease"> <mkdir dir="../releases"/> - <java classname="org.smartfrog.Version" - failonerror="true" fork="true" - outputproperty="version"> - <arg value="-b"/> - <classpath> - <fileset dir="${dist.lib.dir}"> - <include name="**/*.jar"/> - </fileset> - </classpath> + <java classname="org.smartfrog.Version" + failonerror="true" fork="true" + outputproperty="version"> + <arg value="-b"/> + <classpath> + <fileset dir="${dist.lib.dir}"> + <include name="**/*.jar"/> + </fileset> + </classpath> </java> <!--copy todir="${dist.lib.dir}"> <fileset dir="${dist.lib.dir}"> @@ -205,287 +304,361 @@ <mapper type="glob" from="*.jar" to="*-${version}.jar"/> </copy--> </target> + + <target name="ready-to-release" depends="init, initrelease, fixCRLF" > + <!--base prefix for zipping/tarring things, so it expands into a subdir--> + + <property name="prefix" value="${Name.System}.${version}" /> + <mkdir dir="${release.dir}" /> + <mkdir dir="${release.unzip.dir}" /> + + <property name="dist.zip" location="${release.dir}/${prefix}.${DSTAMP}_dist.zip"/> + <property name="all.zip" location="${release.dir}/${prefix}.${DSTAMP}_all.zip"/> + <property name="dist.tar" location="${release.dir}/${prefix}.${DSTAMP}_dist.tar"/> + <property name="dist.tar.gz" location="${dist.tar}.gz"/> + <property name="all.tar" location="${release.dir}/${prefix}.${DSTAMP}_all.tar"/> + <property name="all.tar.gz" location="${all.tar}.gz"/> + + </target> + + <target name="zipfilesets" depends="ready-to-release"> + <zipfileset id="doc.files.zf" dir="docs" prefix="${prefix}/docs"> + <patternset refid="docs.pattern" /> + </zipfileset> + <!--docs in the dist/docs subdir--> + <zipfileset id="dist.doc.files.zf" dir="${dist}/docs/" + prefix="${prefix}/dist/docs"> + <patternset refid="docs.pattern" /> + </zipfileset> + <!-- distributables. Leaves out but docs but includes binaries without setting permissions--> + <zipfileset id="dist.main.zf" dir="${dist}" prefix="${prefix}/dist"> + <include name="**"/> + <!--exclude name="lib/**"/--> + <exclude name="bin/**"/> + <exclude name="docs/**"/> + <exclude name="classes/**"/> + <patternset refid="excluded.cruft"/> + </zipfileset> + + <!--binaries. Does not include bin/security --> + <zipfileset id="dist.unix.bin.zf" dir="${dist}/bin/" + filemode="${exec}" prefix="${prefix}/dist/bin"> + <patternset refid="unix.bin" /> + </zipfileset> + <zipfileset id="dist.other.bin.zf" + dir="${dist}/bin/" prefix="${prefix}/dist/bin"> + <patternset refid="other.bin" /> + </zipfileset> + <zipfileset id="security.unix.bin.zf" dir="${dist}/bin/security" filemode="${exec}" + prefix="${prefix}/dist/bin/security"> + <patternset refid="unix.bin" /> + </zipfileset> + <zipfileset id="security.other.bin.zf" dir="${dist}/bin/security" + prefix="${prefix}/dist/bin/security"> + <patternset refid="other.bin" /> + </zipfileset> + <zipfileset id="unix.bin.zf" dir="bin" filemode="${exec}" + prefix="${prefix}/bin"> + <patternset refid="unix.bin" /> + </zipfileset> + <zipfileset id="other.bin.zf" dir="bin" + prefix="${prefix}/bin"> + <patternset refid="other.bin" /> + </zipfileset> + <zipfileset id="lib.zf" dir="lib" + prefix="${prefix}/lib"> + <patternset refid="other.bin" /> + </zipfileset> + <zipfileset id="other.bin.zf" dir="bin" + prefix="${prefix}/bin"> + <patternset refid="other.bin" /> + </zipfileset> + <!-- source --> + <zipfileset id="main.zf" dir="." + prefix="${prefix}/"> + <patternset refid="source.pattern" /> + </zipfileset> + <zipfileset id="lib.zf" dir="." + prefix="${prefix}/lib"> + <patternset refid="lib.pattern" /> + </zipfileset> + + + <presetdef name="make-dist-zip"> + <zip duplicate="fail"> + <zipfileset refid="dist.main.zf" /> + <zipfileset refid="dist.doc.files.zf" /> + <zipfileset refid="dist.unix.bin.zf" /> + <zipfileset refid="dist.other.bin.zf" /> + <zipfileset refid="security.unix.bin.zf" /> + <zipfileset refid="security.other.bin.zf" /> + </zip> + </presetdef> + </target> + + <target name="dist-zip" depends="zipfilesets" + description="distribution zip"> + <make-dist-zip destfile="${dist.zip}" /> + </target> + + <target name="dist-unzip" depends="dist-zip"> + <property name="dist.unzip.dir" location="${release.unzip.dir}/zip/dist" /> + <delete dir="${dist.unzip.dir}" /> + <mkdir dir="${dist.unzip.dir}" /> + <unzip dest="${dist.unzip.dir}" src="${dist.zip}"/> + </target> + + + <target name="all-zip" depends="zipfilesets" + description="all zip"> + <!--extend the dist file with extra stuff--> + <make-dist-zip destfile="${all.zip}" > + <zipfileset refid="doc.files.zf"/> + <zipfileset refid="unix.bin.zf" /> + <zipfileset refid="other.bin.zf" /> + <zipfileset refid="main.zf" /> + <zipfileset refid="lib.zf" /> + </make-dist-zip> + </target> + + <target name="all-unzip" depends="all-zip"> + <property name="all.unzip.dir" location="${release.unzip.dir}/zip/all" /> + <delete dir="${all.unzip.dir}" /> + <mkdir dir="${all.unzip.dir}" /> + <unzip dest="${all.unzip.dir}" src="${all.zip}"/> + </target> + + <!-- + Make the zipfiles, and expand them in place + --> + <target name="zip" depends="dist-zip,all-zip" /> + <!-- + Make the zipfiles, and expand them in place + --> + <target name="unzip" depends="dist-unzip,all-unzip" /> + + <target name="tarfilesets" depends="ready-to-release"> + <tarfileset id="doc.files.tf" dir="docs" prefix="${prefix}/docs"> + <patternset refid="docs.pattern" /> + </tarfileset> + <!--docs in the dist/docs subdir--> + <tarfileset id="dist.doc.files.tf" dir="${dist}/docs/" + prefix="${prefix}/dist/docs"> + <patternset refid="docs.pattern" /> + </tarfileset> + <!-- distributables. Leaves out but docs but includes binaries without setting permissions--> + <tarfileset id="dist.main.tf" dir="${dist}" prefix="${prefix}/dist"> + <include name="**"/> + <!--exclude name="lib/**"/--> + <exclude name="bin/**"/> + <exclude name="docs/**"/> + <exclude name="classes/**"/> + <patternset refid="excluded.cruft"/> + </tarfileset> + + <!--binaries. Does not include bin/security --> + <tarfileset id="dist.unix.bin.tf" dir="${dist}/bin/" + mode="${exec}" prefix="${prefix}/dist/bin"> + <patternset refid="unix.bin" /> + </tarfileset> + <tarfileset id="dist.other.bin.tf" + dir="${dist}/bin/" prefix="${prefix}/dist/bin"> + <patternset refid="other.bin" /> + </tarfileset> + <tarfileset id="security.unix.bin.tf" dir="${dist}/bin/security" mode="${exec}" + prefix="${prefix}/dist/bin/security"> + <patternset refid="unix.bin" /> + </tarfileset> + <tarfileset id="security.other.bin.tf" dir="${dist}/bin/security" + prefix="${prefix}/dist/bin/security"> + <patternset refid="other.bin" /> + </tarfileset> + <tarfileset id="unix.bin.tf" dir="bin" mode="${exec}" + prefix="${prefix}/bin"> + <patternset refid="unix.bin" /> + </tarfileset> + <tarfileset id="other.bin.tf" dir="bin" + prefix="${prefix}/bin"> + <patternset refid="other.bin" /> + </tarfileset> + <tarfileset id="lib.tf" dir="lib" + prefix="${prefix}/lib"> + <patternset refid="other.bin" /> + </tarfileset> + <tarfileset id="other.bin.tf" dir="bin" + prefix="${prefix}/bin"> + <patternset refid="other.bin" /> + </tarfileset> + <!-- source --> + <tarfileset id="main.tf" dir="." + prefix="${prefix}/"> + <patternset refid="source.pattern" /> + </tarfileset> + <tarfileset id="lib.tf" dir="." + prefix="${prefix}/lib"> + <patternset refid="lib.pattern" /> + </tarfileset> + + + <presetdef name="make-dist-tar"> + <tar > + <tarfileset refid="dist.main.tf" /> + <tarfileset refid="dist.doc.files.tf" /> + <tarfileset refid="dist.unix.bin.tf" /> + <tarfileset refid="dist.other.bin.tf" /> + <tarfileset refid="security.unix.bin.tf" /> + <tarfileset refid="security.other.bin.tf" /> + </tar> + </presetdef> + </target> + + + <target name="dist-tar" depends="tarfilesets" + description="distribution tar"> + <make-dist-tar destfile="${dist.tar}" /> + <gzip src="${dist.tar}" zipfile="${dist.tar.gz}"/> + </target> + + <target name="dist-untar" depends="dist-tar"> + <property name="dist.untar.dir" location="${release.unzip.dir}/tar/dist" /> + <delete dir="${dist.untar.dir}" /> + <mkdir dir="${dist.untar.dir}" /> + <untar dest="${dist.untar.dir}" src="${dist.tar}"/> + </target> + + + <!--extend the dist file with extra stuff--> + <target name="all-tar" depends="tarfilesets" + description="all tar"> + <make-dist-tar destfile="${all.tar}" > + <tarfileset refid="doc.files.zf"/> + <tarfileset refid="unix.bin.zf" /> + <tarfileset refid="other.bin.zf" /> + <tarfileset refid="main.zf" /> + <tarfileset refid="lib.zf" /> + </make-dist-tar> + <gzip src="${all.tar}" zipfile="${all.tar.gz}"/> + </target> + + <target name="all-untar" depends="all-tar"> + <property name="all.untar.dir" location="${release.unzip.dir}/tar/all" /> + <delete dir="${all.untar.dir}" /> + <mkdir dir="${all.untar.dir}" /> + <untar dest="${all.untar.dir}" src="${all.tar}"/> + </target> + + <!-- + Make the tarfiles, and expand them in place + --> + <target name="tar" depends="dist-tar,all-tar" /> + <!-- + Make the tarfiles, and expand them in place + --> + <target name="untar" depends="dist-untar,all-untar" /> + <!-- =================================================================== --> <!-- release --> <!-- =================================================================== --> - <target name="release" depends="init, initrelease, fixCRLF" description="Creates zip with release packages"> - <zip destfile="../releases/${Name.System}.${version}.${DSTAMP}_DIST.zip"> - <zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/**"/> - <!--exclude name="${dist}/lib/**"/--> - <exclude name="${dist}/docs/**"/> - <exclude name="${dist}/classes/**"/> - </zipfileset> - <zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/docs/sfUserManual.pdf"/> - <include name="${dist}/docs/*.html"/> - <include name="${dist}/docs/dir.JPG"/> - <include name="${dist}/docs/sfReference.pdf"/> - <include name="${dist}/docs/sfDynamicWebServerExample.pdf"/> - <include name="${dist}/docs/sfWorkflow.pdf"/> - <include name="${dist}/docs/sfLogging.pdf"/> - <include name="${dist}/docs/sfQuickRef.pdf"/> - <include name="${dist}/docs/sfShellScript.pdf"/> - <include name="${dist}/docs/SmartFrogTutorial.pdf"/> - <include name="${dist}/docs/ant_tasks_for_smartfrog.pdf"/> - <include name="${dist}/docs/SFGuiManual.pdf"/> - <include name="${dist}/docs/IDE_development.pdf"/> - <include name="${dist}/docs/components/**"/> - <include name="${dist}/docs/antTasksManual/**"/> - <include name="${dist}/docs/skin/**"/> - <include name="${dist}/docs/images/**"/> - <include name="${dist}/docs/csfExtensions.pdf"/> - <include name="${dist}/docs/jdocs/**"/> - <include name="${dist}/docs/smartfrogdoc/**"/> - </zipfileset> - <!--zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/lib/**/*-${version}.jar"/> - </zipfileset--> - </zip> + <target name="release" depends="dist-zip" + description="Creates zip with release packages"> + </target> - <zip destfile="../releases/${Name.System}.${version}.${DSTAMP}_ALL.zip"> - <zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="bin/**"/> - <include name="docs/sfUserManual.pdf"/> - <include name="docs/*.html"/> - <include name="docs/dir.JPG"/> - <include name="docs/sfReference.pdf"/> - <include name="docs/sfDynamicWebServerExample.pdf"/> - <include name="docs/sfWorkflow.pdf"/> - <include name="docs/sfLogging.pdf"/> - <include name="docs/sfQuickRef.pdf"/> - <include name="docs/sfShellScript.pdf"/> - <include name="docs/SmartFrogTutorial.pdf"/> - <include name="docs/ant_tasks_for_smartfrog.pdf"/> - <include name="docs/SFGuiManual.pdf"/> - <include name="docs/IDE_development.pdf"/> - <include name="docs/components/filesystem.pdf"/> - <include name="docs/csfExtensions.pdf"/> - <include name="docs/components/**"/> - <include name="docs/antTasksManual/**"/> - <include name="docs/skin/**"/> - <include name="docs/images/**"/> - <include name="lib/**"/> - <!--include name="lib/**/*-${version}.jar"/> - <include name="lib/readme.txt"/--> - <include name="src/**"/> - <include name="private/**"/> - <include name="testCA/**"/> - <include name="javacc/*"/> - <include name="build.xml"/> - <include name="releaseBuild.xml"/> - <include name="parsertargets"/> - <include name="COPYRIGHT.txt"/> - <include name="LICENSE.txt"/> - <include name="changes.txt"/> - <include name="readme.txt"/> - <include name="sf-build-version.properties"/> - <exclude name="**/SVN" /> - <exclude name="**/*.dfPackage" /> - <exclude name="**/Cvs" /> - <exclude name="**/.#*" /> - <exclude name="**/*.*~" /> - <include name="../testharness/build.xml"/> - <include name="../testharness/testcases/build.xml"/> - </zipfileset> - <zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/**"/> - <!--exclude name="${dist}/lib/**"/--> - <exclude name="${dist}/docs/**"/> - <exclude name="${dist}/classes/**"/> - </zipfileset> - <zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/docs/sfUserManual.pdf"/> - <include name="${dist}/docs/*.html"/> - <include name="${dist}/docs/dir.JPG"/> - <include name="${dist}/docs/sfReference.pdf"/> - <include name="${dist}/docs/sfDynamicWebServerExample.pdf"/> - <include name="${dist}/docs/sfWorkflow.pdf"/> - <include name="${dist}/docs/sfLogging.pdf"/> - <include name="${dist}/docs/sfQuickRef.pdf"/> - <include name="${dist}/docs/sfShellScript.pdf"/> - <include name="${dist}/docs/SmartFrogTutorial.pdf"/> - <include name="${dist}/docs/ant_tasks_for_smartfrog.pdf"/> - <include name="${dist}/docs/SFGuiManual.pdf"/> - <include name="${dist}/docs/IDE_development.pdf"/> - <include name="${dist}/docs/components/filesystem.pdf"/> - <include name="${dist}/docs/csfExtensions.pdf"/> - <include name="${dist}/docs/components/**"/> - <include name="${dist}/docs/antTasksManual/**"/> - <include name="${dist}/docs/skin/**"/> - <include name="${dist}/docs/images/**"/> - <include name="${dist}/docs/jdocs/**"/> - <include name="${dist}/docs/smartfrogdoc/**"/> - </zipfileset> - <!--zipfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/lib/**/*-${version}.jar"/> - </zipfileset--> - </zip> - <tar tarfile="../releases/${Name.System}.${version}.${DSTAMP}_DIST.tar" > - <tarfileset dir="." prefix="${Name.System}.${version}"> + <target name="expand" depends="unzip,untar" + description="make the distributables, then expand them" /> + + <target name="oldrelease" depends="dist-zip" > + + <tar tarfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" > + <tarfileset dir="." prefix="${prefix}"> <include name="${dist}/bin/**/*.sf"/> <include name="${dist}/bin/**/*.bat"/> <include name="${dist}/bin/**/*.ini"/> </tarfileset> - <tarfileset dir="." prefix="${Name.System}.${version}" > + <tarfileset dir="." prefix="${prefix}" > <exclude name="${dist}/bin/**"/> - <include name="${dist}/**"/> + <include name="${dist}/**"/> <!--exclude name="${dist}/lib/**"/--> <exclude name="${dist}/classes/**"/> <exclude name="${dist}/docs/**"/> + <patternset refid="excluded.cruft"/> </tarfileset> - <tarfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/docs/sfUserManual.pdf"/> - <include name="${dist}/docs/*.html"/> - <include name="${dist}/docs/dir.JPG"/> - <include name="${dist}/docs/sfReference.pdf"/> - <include name="${dist}/docs/sfDynamicWebServerExample.pdf"/> - <include name="${dist}/docs/sfWorkflow.pdf"/> - <include name="${dist}/docs/sfLogging.pdf"/> - <include name="${dist}/docs/sfQuickRef.pdf"/> - <include name="${dist}/docs/sfShellScript.pdf"/> - <include name="${dist}/docs/SmartFrogTutorial.pdf"/> - <include name="${dist}/docs/ant_tasks_for_smartfrog.pdf"/> - <include name="${dist}/docs/SFGuiManual.pdf"/> - <include name="${dist}/docs/IDE_development.pdf"/> - <include name="${dist}/docs/components/filesystem.pdf"/> - <include name="${dist}/docs/csfExtensions.pdf"/> - <include name="${dist}/docs/components/**"/> - <include name="${dist}/docs/antTasksManual/**"/> - <include name="${dist}/docs/skin/**"/> - <include name="${dist}/docs/images/**"/> - <include name="${dist}/docs/jdocs/**"/> - <include name="${dist}/docs/smartfrogdoc/**"/> + <tarfileset dir="${dist}/docs/" prefix="${prefix}/dist/docs"> + <patternset refid="docs.pattern" /> </tarfileset> - <!--tarfileset dir="." prefix="${Name.System}.${version}"> + <!--tarfileset dir="." prefix="${prefix}"> <include name="${dist}/lib/**/*-${version}.jar"/> </tarfileset--> - <tarfileset dir="." mode="755" prefix="${Name.System}.${version}"> + <tarfileset dir="." mode="755" prefix="${prefix}"> <include name="${dist}/bin/**"/> <exclude name="${dist}/bin/**/*.sf"/> <exclude name="${dist}/bin/**/*.bat"/> <exclude name="${dist}/bin/**/*.ini"/> </tarfileset> </tar> - <gzip src="../releases/${Name.System}.${version}.${DSTAMP}_DIST.tar" zipfile="../releases/${Name.System}.${version}.${DSTAMP}_DIST.tar.gz"/> - <delete file="../releases/${Name.System}.${version}.${DSTAMP}_DIST.tar"/> + <gzip src="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" zipfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar.gz"/> + <delete file="${release.dir}/${prefix}.${DSTAMP}_DIST.tar"/> - <tar tarfile="../releases/${Name.System}.${version}.${DSTAMP}_ALL.tar"> - <tarfileset dir="." prefix="${Name.System}.${version}"> + <tar tarfile="${release.dir}/${prefix}.${DSTAMP}_ALL.tar" > + <tarfileset dir="." prefix="${prefix}"> <include name="bin/**/*.sf"/> - <include name="bin/**/*.bat"/> + e <include name="bin/**/*.bat"/> <include name="bin/**/*.ini"/> - <include name="docs/sfUserManual.pdf"/> - <include name="docs/*.html"/> - <include name="docs/dir.JPG"/> - <include name="docs/sfReference.pdf"/> - <include name="docs/sfDynamicWebServerExample.pdf"/> - <include name="docs/sfWorkflow.pdf"/> - <include name="docs/sfLogging.pdf"/> - <include name="docs/sfQuickRef.pdf"/> - <include name="docs/sfShellScript.pdf"/> - <include name="docs/SmartFrogTutorial.pdf"/> - <include name="docs/ant_tasks_for_smartfrog.pdf"/> - <include name="docs/SFGuiManual.pdf"/> - <include name="docs/IDE_development.pdf"/> - <include name="docs/components/filesystem.pdf"/> - <include name="docs/csfExtensions.pdf"/> - <include name="docs/components/**"/> - <include name="docs/antTasksManual/**"/> - <include name="docs/skin/**"/> - <include name="docs/images/**"/> - <include name="lib/**"/> + <include name="lib/**"/> <!--include name="lib/*-${version}.jar"/> <include name="lib/readme.txt"/--> - <include name="src/**"/> - <include name="private/**"/> - <include name="testCA/**"/> - <include name="javacc/*"/> - <include name="build.xml"/> - <include name="releaseBuild.xml"/> - <include name="parsertargets"/> - <include name="COPYRIGHT.txt"/> - <include name="LICENSE.txt"/> - <include name="changes.txt"/> - <include name="readme.txt"/> - <include name="sf-build-version.properties"/> - <exclude name="**/SVN" /> - <exclude name="**/*.dfPackage" /> - <exclude name="**/Cvs" /> - <exclude name="bin/tools/**"/> - <exclude name="**/.#*" /> - <exclude name="**/*.*~" /> - <include name="../testharness/build.xml"/> - <include name="../testharness/testcases/build.xml"/> + <patternset refid="source.pattern"/> </tarfileset> - <tarfileset dir="." prefix="${Name.System}.${version}" mode="755"> + <tarfileset dir="bin" prefix="${prefix}/bin" mode="755"> + <patternset refid="unix.bin" /> <include name="bin/**"/> <exclude name="bin/**/*.sf"/> <exclude name="bin/**/*.bat"/> <exclude name="bin/**/*.ini"/> </tarfileset> - - <tarfileset dir="." prefix="${Name.System}.${version}"> + <tarfileset dir="docs/" prefix="${prefix}/docs"> + <patternset refid="docs.pattern" /> + </tarfileset> + <tarfileset dir="${dist}/docs/" prefix="${prefix}/dist/docs"> + <patternset refid="docs.pattern" /> + </tarfileset> + <tarfileset dir="." prefix="${prefix}"> <include name="${dist}/bin/**/*.sf"/> <include name="${dist}/bin/**/*.bat"/> <include name="${dist}/bin/**/*.ini"/> </tarfileset> - <tarfileset dir="." prefix="${Name.System}.${version}"> + <tarfileset dir="." prefix="${prefix}"> <exclude name="${dist}/bin/**"/> - <include name="${dist}/**"/> + <include name="${dist}/**"/> <!--exclude name="${dist}/lib/**"/--> <exclude name="${dist}/classes/**"/> <exclude name="${dist}/classes/**"/> <exclude name="${dist}/docs/**"/> </tarfileset> - <tarfileset dir="." prefix="${Name.System}.${version}"> - <include name="${dist}/docs/sfUserManual.pdf"/> - <include name="${dist}/docs/*.html"/> - <include name="${dist}/docs/dir.JPG"/> - <include name="${dist}/docs/sfReference.pdf"/> - <include name="${dist}/docs/sfDynamicWebServerExample.pdf"/> - <include name="${dist}/docs/sfWorkflow.pdf"/> - <include name="${dist}/docs/sfLogging.pdf"/> - <include name="${dist}/docs/sfQuickRef.pdf"/> - <include name="${dist}/docs/sfShellScript.pdf"/> - <include name="${dist}/docs/SmartFrogTutorial.pdf"/> - <include name="${dist}/docs/ant_tasks_for_smartfrog.pdf"/> - <include name="${dist}/docs/SFGuiManual.pdf"/> - <include name="${dist}/docs/IDE_development.pdf"/> - <include name="${dist}/docs/components/filesystem.pdf"/> - <include name="${dist}/docs/csfExtensions.pdf"/> - <include name="${dist}/docs/components/**"/> - <include name="${dist}/docs/antTasksManual/**"/> - <include name="${dist}/docs/skin/**"/> - <include name="${dist}/docs/images/**"/> - <include name="${dist}/docs/jdocs/**"/> - <include name="${dist}/docs/smartfrogdoc/**"/> - </tarfileset> - <!--tarfileset dir="." prefix="${Name.System}.${version}"> + <!--tarfileset dir="." prefix="${prefix}"> <include name="${dist}/lib/**/*-${version}.jar"/> </tarfileset--> - <tarfileset dir="." mode="755" prefix="${Name.System}.${version}"> + <tarfileset dir="." mode="755" prefix="${prefix}"> <include name="${dist}/bin/**"/> <exclude name="${dist}/bin/**/*.sf"/> <exclude name="${dist}/bin/**/*.bat"/> <exclude name="${dist}/bin/**/*.ini"/> </tarfileset> </tar> - <gzip src="../releases/${Name.System}.${version}.${DSTAMP}_ALL.tar" zipfile="../releases/${Name.System}.${version}.${DSTAMP}_ALL.tar.gz"/> - <delete file="../releases/${Name.System}.${version}.${DSTAMP}_ALL.tar"/> + <gzip src="${release.dir}/${prefix}.${DSTAMP}_ALL.tar" zipfile="${release.dir}/${prefix}.${DSTAMP}_ALL.tar.gz"/> + <delete file="${release.dir}/${prefix}.${DSTAMP}_ALL.tar"/> <!-- - <zip destfile="../${Name.System}.${version}.${DSTAMP}_JDOCS.zip"> - <zipfileset dir="." prefix="${Name.System}.${version}"> + <zip destfile="../${prefix}.${DSTAMP}_JDOCS.zip"> + <zipfileset dir="." prefix="${prefix}"> <include name="${dist}/docs/jdocs/**"/> </zipfileset> </zip> - <tar tarfile="../${Name.System}.${version}.${DSTAMP}_JDOCS.tar" > - <tarfileset dir="." prefix="${Name.System}.${version}"> + <tar tarfile="../${prefix}.${DSTAMP}_JDOCS.tar" > + <tarfileset dir="." prefix="${prefix}"> <include name="${dist}/docs/jdocs/**"/> </tarfileset> </tar> - <gzip src="../${Name.System}.${version}.${DSTAMP}_JDOCS.tar" zipfile="../${Name.System}.${version}.${DSTAMP}_JDOCS.tar.gz"/> - <delete file="../${Name.System}.${version}.${DSTAMP}_JDOCS.tar"/> + <gzip src="../${prefix}.${DSTAMP}_JDOCS.tar" zipfile="../${prefix}.${DSTAMP}_JDOCS.tar.gz"/> + <delete file="../${prefix}.${DSTAMP}_JDOCS.tar"/> --> <!--delete> Modified: trunk/core/smartfrog/releaseBuild.xml =================================================================== --- trunk/core/smartfrog/releaseBuild.xml 2007-01-16 15:37:37 UTC (rev 3813) +++ trunk/core/smartfrog/releaseBuild.xml 2007-01-18 13:54:23 UTC (rev 3814) @@ -60,9 +60,8 @@ <!-- =================================================================== --> <target name="init"> <property name="Name" value="SmartFrog"/> - <property name="name" value="(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP"/> + <property name="name" value="(C) Copyright 1998-2007 Hewlett-Packard Development Company, LP"/> <property name="version" value="DIST"/> - <!--property name="Version" value="3.04.014.beta"/--> <property name="year" value=""/> <echo message=""/> <echo message="==================================================================="/> @@ -157,6 +156,7 @@ <!-- =================================================================== --> <target name="fixCRLF" description="adapts CRLF for different OS"> + <!-- OS dependant --> <fixcrlf srcdir="${dist}/${bin}" includes="**/**" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-03-21 15:15:07
|
Revision: 3996 http://svn.sourceforge.net/smartfrog/?rev=3996&view=rev Author: steve_l Date: 2007-03-21 08:03:30 -0700 (Wed, 21 Mar 2007) Log Message: ----------- SFOS-48 : making the time the temp file/dir is created (Deploy or start) configurable...docs updated accordingly, tests still passing Modified Paths: -------------- trunk/core/smartfrog/COPYRIGHT.txt trunk/core/smartfrog/docs/components/filesystem.sxw trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempDirImpl.java trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFile.java trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFileImpl.java trunk/core/smartfrog/src/org/smartfrog/services/filesystem/tempfile.sf Modified: trunk/core/smartfrog/COPYRIGHT.txt =================================================================== --- trunk/core/smartfrog/COPYRIGHT.txt 2007-03-21 12:23:53 UTC (rev 3995) +++ trunk/core/smartfrog/COPYRIGHT.txt 2007-03-21 15:03:30 UTC (rev 3996) @@ -36,5 +36,6 @@ limitations under the License. File to which this apply are: -org.smartfrog.sfcore.common.Diagnostics -org.smartfrog.sfcore.logging.LogToStreamsImpl \ No newline at end of file + org.smartfrog.sfcore.common.Diagnostics + org.smartfrog.sfcore.logging.LogToStreamsImpl + org.smartfrog.services.database.core.TransactionImpl \ No newline at end of file Modified: trunk/core/smartfrog/docs/components/filesystem.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempDirImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempDirImpl.java 2007-03-21 12:23:53 UTC (rev 3995) +++ trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempDirImpl.java 2007-03-21 15:03:30 UTC (rev 3996) @@ -21,6 +21,7 @@ import org.smartfrog.sfcore.common.SmartFrogException; import org.smartfrog.sfcore.prim.TerminationRecord; +import org.smartfrog.sfcore.utils.ComponentHelper; import java.rmi.RemoteException; @@ -31,6 +32,7 @@ public class TempDirImpl extends FileUsingComponentImpl implements TempFile { private boolean delete=false; + private boolean createOnDeploy; /** * Constructor. @@ -46,28 +48,39 @@ * heartbeat. Subclasses can override to provide additional deployment * behavior. * - * @throws org.smartfrog.sfcore.common.SmartFrogException + * @throws SmartFrogException * error while deploying - * @throws java.rmi.RemoteException In case of network/rmi error + * @throws RemoteException In case of network/rmi error */ public synchronized void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); - readAttributesAndCreateDir(); + createOnDeploy = sfResolve(ATTR_CREATE_ON_DEPLOY, createOnDeploy, true); + if (createOnDeploy) { + readAttributesAndCreateDir(); + } } /** * start the component * - * @throws org.smartfrog.sfcore.common.SmartFrogException error wile starting + * @throws SmartFrogException error wile starting * - * @throws java.rmi.RemoteException In case of network/rmi error + * @throws RemoteException In case of network/rmi error */ public synchronized void sfStart() throws SmartFrogException, RemoteException { super.sfStart(); + if (!createOnDeploy) { + readAttributesAndCreateDir(); + } + //maybe terminate + new ComponentHelper(this).sfSelfDetachAndOrTerminate(null, + "Created temp dir " + file, + null, + null); } /** - * + * create the temporary directory * @throws RemoteException In case of network/rmi error * @throws SmartFrogException error while reading attributes */ Modified: trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFile.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFile.java 2007-03-21 12:23:53 UTC (rev 3995) +++ trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFile.java 2007-03-21 15:03:30 UTC (rev 3996) @@ -32,28 +32,36 @@ /** * any optional text */ - public static final String ATTR_TEXT = "text"; + String ATTR_TEXT = "text"; /** * text encoding {@value} */ - public static final String ATTR_TEXT_ENCODING = "encoding"; + String ATTR_TEXT_ENCODING = "encoding"; /** * temp filename prefix {@value} */ - public static final String ATTR_PREFIX="prefix"; + String ATTR_PREFIX="prefix"; /** * temp filename suffix {@value} */ - public static final String ATTR_SUFFIX = "suffix"; + String ATTR_SUFFIX = "suffix"; /** * temp file directory {@value} */ - public static final String ATTR_DIRECTORY = "dir"; + String ATTR_DIRECTORY = "dir"; //this is the filename that is created - //public static final String ATTR_FILENAME = "filename"; + //String ATTR_FILENAME = "filename"; /** + * Flag to control whether the file is created at deploy time or system start. + * Early creation lets us publish our attribute for others, but may mean that + * not everything is set up. + * {@value} + */ + String ATTR_CREATE_ON_DEPLOY = "createOnDeploy"; + + /** * get the filename of this file * * @return the filename Modified: trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFileImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFileImpl.java 2007-03-21 12:23:53 UTC (rev 3995) +++ trunk/core/smartfrog/src/org/smartfrog/services/filesystem/TempFileImpl.java 2007-03-21 15:03:30 UTC (rev 3996) @@ -38,6 +38,8 @@ public static final String ERROR_PREFIX_EMPTY = ATTR_PREFIX+ " can not be an empty string"; + private boolean createOnDeploy; + /** * create a temporary file instance; do no real work (yet) * @throws RemoteException In case of network/rmi error @@ -53,13 +55,25 @@ */ public synchronized void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); + createOnDeploy= sfResolve(ATTR_CREATE_ON_DEPLOY, createOnDeploy, true); + if(createOnDeploy) { + createTempFile(); + } + } + + /** + * Create the temporary file + * @throws SmartFrogException error while deploying + * @throws RemoteException In case of network/rmi error + */ + private void createTempFile() throws RemoteException, SmartFrogException { String prefix = sfResolve(ATTR_PREFIX, "", true); if(prefix.length()==0) { throw new SmartFrogException(ERROR_PREFIX_EMPTY,this); } String suffix = sfResolve(ATTR_SUFFIX, (String) null, false); String dir; - dir=FileSystem.lookupAbsolutePath(this,ATTR_DIRECTORY,null,null,false,null); + dir= FileSystem.lookupAbsolutePath(this,ATTR_DIRECTORY,null,null,false,null); String text = sfResolve(ATTR_TEXT, (String) null, false); @@ -94,6 +108,11 @@ public synchronized void sfStart() throws SmartFrogException, RemoteException { super.sfStart(); + if (!createOnDeploy) { + //create the temp file now + createTempFile(); + } + //maybe terminate new ComponentHelper(this).sfSelfDetachAndOrTerminate(null, "Created temp file " + file, Modified: trunk/core/smartfrog/src/org/smartfrog/services/filesystem/tempfile.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/filesystem/tempfile.sf 2007-03-21 12:23:53 UTC (rev 3995) +++ trunk/core/smartfrog/src/org/smartfrog/services/filesystem/tempfile.sf 2007-03-21 15:03:30 UTC (rev 3996) @@ -34,7 +34,9 @@ //encoding of the optional text. Only needed when text is set encoding extends String; //should the file be deleted - deleteOnExit extends OptionalBoolean; + deleteOnExit extends Boolean; + //should the file be created early or late + createOnDeploy extends Boolean; } /** @@ -47,6 +49,7 @@ //default encoding is utf8 encoding "UTF-8"; deleteOnExit false; + createOnDeploy true; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-03-22 17:00:30
|
Revision: 4007 http://svn.sourceforge.net/smartfrog/?rev=4007&view=rev Author: steve_l Date: 2007-03-22 10:00:24 -0700 (Thu, 22 Mar 2007) Log Message: ----------- Cleaned up security files...this does work in a main build, but needs testing in the distribution Modified Paths: -------------- trunk/core/smartfrog/build.xml trunk/core/smartfrog/buildRelease.xml trunk/core/smartfrog/private/buildSecurity.xml trunk/core/smartfrog/releaseBuild.xml Modified: trunk/core/smartfrog/build.xml =================================================================== --- trunk/core/smartfrog/build.xml 2007-03-22 16:59:42 UTC (rev 4006) +++ trunk/core/smartfrog/build.xml 2007-03-22 17:00:24 UTC (rev 4007) @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!-- - /** (C) Copyright 1998-2006 Hewlett-Packard Development Company, LP + /** (C) Copyright 1998-2007 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -15,26 +15,29 @@ For more information: www.smartfrog.org */ --> -<!DOCTYPE project [ - <!ENTITY security SYSTEM "private/buildSecurity.xml"> -]> <project name="SmartFrog" default="all" basedir="." xmlns:ivy="antlib:fr.jayasoft.ivy.ant"> <description> Introduction ============ The build script for SmartFrog framework. - To run the build script ant must be installed - and ant executable should be in the system path. + It requires + -Java1.4 or later. Java 1.5 is recommended + -Ant 1.7 or later + -Ivy 1.4.1 (from jayasoft.fr, or soon, apache.org) + A copy of JavaCC is needed if the language itself is changed. Installing the build tools ========================== - Please go though the installation guide and install ant 1.6.5 or later. + Please go though the installation guide and install Ant1.7 or later. Reference URL:http://ant.apache.org For JavaCC, download it from https://javacc.dev.java.net/ and install the relevant JAR files into the javacc subdirectory </description> + + + <!-- =================================================================== --> <!-- Initialization target --> <!-- =================================================================== --> @@ -50,13 +53,19 @@ <echo level="verbose"> =================================================================== = ${Name.System} ${version} - " - = ${Name.Company} =================================================================== - (${ant.version}) </echo> - <available property="nice.task.present" classname="org.apache.tools.ant.taskdefs.Nice"/> + <fail> + <condition> + <not> + <available + classname="org.apache.tools.ant.types.resources.FileResourceIterator"/> + </not> + </condition> + This version of Ant is not supported. + Please upgrade to Ant1.7 or later and build this project again + </fail> </target> <!-- =================================================================== --> <!-- Help on usage --> @@ -165,10 +174,18 @@ - <!-- Include here the security-related ant file --> - &security; - <!-- End of security-related ant file --> <!-- ================================================================== --> + <!-- Import the security-related ant file --> + <!-- ================================================================== --> + <import file="${private}/buildSecurity.xml"/> + + <target name="ready-to-create-CA" depends="copyPrivate,security.ready-to-create-CA"> + + </target> + + + + <!-- ================================================================== --> <!-- running Version.java to generate version information --> <!-- ================================================================== --> @@ -221,7 +238,9 @@ <!-- Generte Forrest Docs --> <!-- =================================================================== --> - <target name="generatedoc" depends="init, dist, jdocs" description="Document Generation" if="env.FORREST_HOME"> + <target name="generatedoc" depends="init, dist, jdocs" + description="Document Generation" + if="env.FORREST_HOME"> <ant antfile="documentation.xml" inheritall="false"/> <!-- Forrest build dir --> </target> @@ -229,7 +248,8 @@ <!-- =================================================================== --> <!-- Release --> <!-- =================================================================== --> - <target name="release" depends="clean, dist,jdocs, generatedoc" description="Creates clean new release"> </target> + <target name="release" depends="clean, dist,jdocs, generatedoc" + description="Creates clean new release"/> <!-- =================================================================== --> <!-- --> <!-- =================================================================== --> @@ -300,6 +320,7 @@ <target name="compile-rmi" depends="rmi" /> <target name="compile" depends="compile-rmi" description="Compiles the source code"/> + <!-- =================================================================== --> <!-- Copy default.sf and default.ini files to "src/org/smartfrog" directory --> <!-- so that they can be used with security on --> @@ -376,7 +397,7 @@ <!-- =================================================================== --> <!-- --> <!-- =================================================================== --> - <target name="copylibs" depends="initdist"> + <target name="copylibs" depends="initbuild"> <copy todir="${dist.lib.dir}"> <fileset dir="${lib}"> <include name="**/*.jar"/> @@ -386,7 +407,7 @@ <!-- =================================================================== --> <!-- --> <!-- =================================================================== --> - <target name="copyPrivate" depends="initdist"> + <target name="copyPrivate" depends="initbuild"> <copy todir="${dist.private.dir}"> <fileset dir="${private}"> <include name="**/*"/> @@ -397,7 +418,7 @@ <!-- =================================================================== --> <!-- --> <!-- =================================================================== --> - <target name="copyTestCA" depends="initdist"> + <target name="copyTestCA" depends="initbuild"> <copy todir="${dist.testCA.dir}"> <fileset dir="${testCA}"> <include name="**/*"/> @@ -605,7 +626,7 @@ </target> <target name="ready-to-dist" - depends="build,jars,copylibs,copybins,copyPrivate,copydocs, + depends="build,jars,copybins,copyPrivate,copydocs, copyexamples,copyTestCA,buildSetup,srczip" /> Modified: trunk/core/smartfrog/buildRelease.xml =================================================================== --- trunk/core/smartfrog/buildRelease.xml 2007-03-22 16:59:42 UTC (rev 4006) +++ trunk/core/smartfrog/buildRelease.xml 2007-03-22 17:00:24 UTC (rev 4007) @@ -1,41 +1,37 @@ <?xml version="1.0"?> -<!-- -/** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP +<project name="Release" default="process" basedir="."> + <!-- + /** (C) Copyright 1998-2007 Hewlett-Packard Development Company, LP -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -For more information: www.smartfrog.org + For more information: www.smartfrog.org -*/ ---> -<!DOCTYPE project [ - <!ENTITY security SYSTEM "./private/buildSecurity.xml"> -]> + */ + --> -<!-- =========================================================================== -Introduction -============ -To use: ant -f buildRelease release -Installing the build tools -========================== -To Be Written ---> -<project name="SmartFrog" default="process" basedir="."> + <description> + This build file creates the release artifacts for the SmartFrog project + Introduction + ============ + To use: ant -f buildRelease release + + </description> <!-- =================================================================== --> <!-- Initialization target --> <!-- =================================================================== --> @@ -43,13 +39,14 @@ <tstamp/> <property name="Name.Framework" value="SmartFrog Framework"/> <property name="Name.System" value="SmartFrog"/> - <property name="year" value="2007"/> - <property name="Name.Company" value="(C) Copyright 1998-2007 Hewlett-Packard Development Company, LP"/> + <tstamp> + <format property="year" pattern="yyyy"/> + </tstamp> + <property name="Name.Company" value="(C) Copyright 1998-${year} Hewlett-Packard Development Company, LP"/> <echo message=""/> <echo message="==================================================================="/> - <echo message="= ${Name.Framework} - ${Name.Company} "/> - <echo message="==================================================================="/> + <echo message="In the release project"/> </target> <!-- =================================================================== --> @@ -115,12 +112,6 @@ <echo message=""/> </target> - <!-- =================================================================== --> - <!-- Initialization path (Libs needed for compiling) --> - <!-- =================================================================== --> - <path id="smartfrog.class.path"> - <pathelement path="${classpath}"/> - </path> <!-- =================================================================== --> <!-- Global properties --> @@ -586,7 +577,7 @@ <patternset refid="docs.pattern" /> </tarfileset> <!--tarfileset dir="." prefix="${prefix}"> - <include name="${dist}/lib/**/*-${version}.jar"/> + <include name="${dist}/lib/**/*-${version}.jar"/> </tarfileset--> <tarfileset dir="." mode="755" prefix="${prefix}"> <include name="${dist}/bin/**"/> @@ -595,7 +586,8 @@ <exclude name="${dist}/bin/**/*.ini"/> </tarfileset> </tar> - <gzip src="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" zipfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar.gz"/> + <gzip src="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" + zipfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar.gz"/> <delete file="${release.dir}/${prefix}.${DSTAMP}_DIST.tar"/> <tar tarfile="${release.dir}/${prefix}.${DSTAMP}_ALL.tar" > Modified: trunk/core/smartfrog/private/buildSecurity.xml =================================================================== --- trunk/core/smartfrog/private/buildSecurity.xml 2007-03-22 16:59:42 UTC (rev 4006) +++ trunk/core/smartfrog/private/buildSecurity.xml 2007-03-22 17:00:24 UTC (rev 4007) @@ -1,210 +1,397 @@ -<!-- -/** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP +<project name="security" xmlns:sec="http://security.smartfrog.org/"> + <!-- + /** (C) Copyright 1998-2007 Hewlett-Packard Development Company, LP -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -For more information: www.smartfrog.org + For more information: www.smartfrog.org -*/ ---> + */ + --> -<!-- CHANGE THESE PASSWORDS NOW!!! --> - <property name="defaultCAPassword" value="pleasechange2"/> + <description> + This file sets up security + -it needs openssl on the local system + - + </description> + <!-- CHANGE THESE PASSWORDS NOW!!! --> + <target name="initCAProperties"> + <property name="defaultCAPassword" value="pleasechange2"/> -<!-- CA related properties --> - <property name="dist.testCA.dir" location="testCA"/> - <property name="dist.dir" location="."/> - <property name="dist.signedLib.dir" location="signedLib"/> - <property name="disttestCA" value="${dist.testCA.dir}"/> -<!-- dist.dir and others are set by surrounding build.xml --> -<!-- <property name="disttestCA" value="${dist.testCA.dir}"/> - <property name="dist.private.dir" value="${dist.dir}/${private}"/> - <property name="distsignedLib" value="${dist.signedLib.dir}"/> - <property name="distlib" value="${dist.lib.dir}"/> - --> - <property name="CAFromPrivate" value="ca"/> + <!-- CA related properties --> + <property name="dist.testCA.dir" location="testCA"/> + <property name="dist.dir" location="."/> + <property name="dist.signedLib.dir" location="signedLib"/> + <property name="disttestCA" value="${dist.testCA.dir}"/> + <!-- dist.dir and others are set by surrounding build.xml --> + <!-- <property name="disttestCA" value="${dist.testCA.dir}"/> + <property name="dist.private.dir" value="${dist.dir}/${private}"/> + <property name="distsignedLib" value="${dist.signedLib.dir}"/> + <property name="distlib" value="${dist.lib.dir}"/> + --> + <property name="CAFromPrivate" value="ca"/> - <!-- REVISIT if the private dir is already defined, this assigment is harmless. - if it is unassigned, it takes.--> - <property name="dist.private.dir" value="${dist.dir}/${private}"/> - <property name="dist.lib.dir" location="lib"/> + <property name="security.uri" value="http://security.smartfrog.org/" /> + <!-- REVISIT if the private dir is already defined, this assigment is harmless. +if it is unassigned, it takes.--> + <property name="dist.private.dir" value="${dist.dir}/${private}"/> + <property name="dist.lib.dir" location="lib"/> - <property name="CA" location="${dist.private.dir}/${CAFromPrivate}"/> - <property name="CAsubdir" value="demoCA"/> + <property name="CA" location="${dist.private.dir}/${CAFromPrivate}"/> + <property name="CAsubdir" value="demoCA"/> - <property name="defaultKeyStore" value="mykeys.st"/> - <property name="defaultCodeSignerCAKeyStore" value="codesigner.st"/> - <property name="defaultPolicyName" value="sf.policy"/> + <property name="defaultKeyStore" value="mykeys.st"/> + <property name="defaultCodeSignerCAKeyStore" value="codesigner.st"/> + <property name="defaultPolicyName" value="sf.policy"/> + <!--length that certificates remain valid--> + <property name="certificate.duration" value="365"/> - <property name="defaultSecProp" value="SFSecurity.properties"/> + <property name="defaultSecProp" value="SFSecurity.properties"/> - <property name="aliasCSKey" value="sfcodesigner"/> - <property name="aliasCommunityKey" value="sfcommunity"/> - <property name="aliasSelfKey" value="self"/> - <property name="randomFile" value=".rnd"/> - <property name="tempPasswdFile" value="passwd"/> - <property name="hostDirPrefix" value="host"/> + <property name="aliasCSKey" value="sfcodesigner"/> + <property name="aliasCommunityKey" value="sfcommunity"/> + <property name="aliasSelfKey" value="self"/> + <property name="randomFile" value=".rnd"/> + <property name="tempPasswdFile" value="passwd"/> + <property name="hostDirPrefix" value="host"/> + <property name="openssl.cnf" location="${CA}/openssl.cnf" /> + </target> -<!-- 1 CA build related tasks --> -<!-- 1.1 creating a new CA from scratch --> + <target name="validateCAsetup" depends="initCAProperties"> + <fail> + <condition> + <not><available file="${openssl.cnf}"/></not> + </condition> + Not found: ${openssl.cnf} + Have all the setup/copy targets been run? + </fail> + </target> -<target name="initCommunityCA"> + <!-- + Override point: do everything needed to create a CA + --> + <target name="ready-to-create-CA" depends="initCAPrograms,validateCAsetup"> + + </target> + + + <!-- 1 CA build related tasks --> + + <target name="initCAPrograms" depends="initCAProperties"> + <presetdef name="openssl" uri="${security.uri}"> + <exec dir="${CA}" executable="openssl"> + </exec> + </presetdef> + <presetdef name="keytool" uri="${security.uri}"> + <exec dir="${CA}" executable="keytool"> + </exec> + </presetdef> + + <macrodef name="signsfjar" uri="${security.uri}"> + <attribute name="name"/> + <sequential> + <signjar + jar="${dist.lib.dir}/@{name}" + signedjar="${dist.signedLib.dir}/@{name}" + alias="${aliasSelfKey}" + keystore="${CA}/${defaultCodeSignerCAKeyStore}" + storepass="${defaultCAPassword}"/> + </sequential> + </macrodef> + </target> + + + + <!-- 1.1 creating a new CA from scratch --> + + <target name="initCommunityCA" depends="ready-to-create-CA"> <!-- Configure some setup files --> <mkdir dir="${CA}/${CAsubdir}"/> <mkdir dir="${CA}/${CAsubdir}/newcerts"/> <touch file="${CA}/${CAsubdir}/index.txt"/> <echo message="01" file="${CA}/${CAsubdir}/serial"/> - <!-- Generate some random data using /dev/urandom in linux/ --> - <exec dir="${CA}" executable="openssl"> - <arg line="rand -rand ${randomFile} -out ${randomFile} 64"/> - </exec> + <!--rand -rand ${randomFile} -out ${randomFile} 64"--> + <sec:openssl> + <arg value="rand"/> + <arg value="-rand"/> + <arg value="${randomFile}"/> + <arg value="-out"/> + <arg value="${randomFile}"/> + <arg value="64"/> + </sec:openssl> - <!-- Generare CA keys. --> - <exec dir="${CA}" executable="openssl"> - <arg line="genrsa -rand ${randomFile} -passout pass:${defaultCAPassword} -des3 -out ca.key 1024"/> - </exec> + <!-- "genrsa -rand ${randomFile} -passout pass:${defaultCAPassword} -des3 -out ca.key 1024"/ --> + <sec:openssl> + <arg value="genrsa"/> + <arg value="-rand"/> + <arg value="${randomFile}"/> + <arg value="-passout"/> + <arg value="pass:${defaultCAPassword}"/> + <arg value="-des3"/> + <arg value="-out"/> + <arg value="ca.key"/> + <arg value="1024"/> + </sec:openssl> - <!-- Generare a selfsigned certificate for the CA --> - <exec dir="${CA}" executable="openssl"> - <arg line="req -config openssl.cnf -new -x509 -passin pass:${defaultCAPassword} -days 365 -key ca.key -out cacert.pem"/> - </exec> + + <!-- Generate a selfsigned certificate for the CA --> + <!-- + req -config openssl.cnf -new -x509 -passin pass:${defaultCAPassword} -days 365 -key ca.key -out cacert.pem + --> + <sec:openssl> + <arg value="req"/> + <arg value="-config"/> + <arg value="openssl.cnf"/> + <arg value="-new"/> + <arg value="-x509"/> + <arg value="-passin"/> + <arg value="pass:${defaultCAPassword}"/> + <arg value="-days"/> + <arg value="${certificate.duration}"/> + <arg value="-key"/> + <arg value="ca.key"/> + <arg value="-out"/> + <arg value="cacert.pem"/> + </sec:openssl> + + <copy file="${CA}/cacert.pem" todir="${CA}/${CAsubdir}"/> -</target> + </target> -<target name="initCodeSignerCA"> - <!-- First generate new keys --> - <genkey alias="${aliasSelfKey}" - keystore="${CA}/${defaultCodeSignerCAKeyStore}" - keyalg="RSA" - storepass="${defaultCAPassword}" - dname="CN=sfCodeSigner, OU=HPL, O=HP, C=UK"/> + <target name="initCodeSignerCA" depends="initCAPrograms"> + <!-- First generate new keys --> + <genkey alias="${aliasSelfKey}" + keystore="${CA}/${defaultCodeSignerCAKeyStore}" + keyalg="RSA" + verbose="true" + validity="${certificate.duration}" + storepass="${defaultCAPassword}" + > + <dname> + <param name="CN" value="sfCodeSigner"/> + <param name="OU" value="HPLaboratories"/> + <param name="O" value="HP"/> + <param name="C" value="UK"/> + </dname> + </genkey> - <!-- Export self-signed certificate --> - <exec dir="${CA}" executable="keytool"> - <arg line="-keystore ${defaultCodeSignerCAKeyStore} -export -alias ${aliasSelfKey} -storepass ${defaultCAPassword} -file codesigner.cer"/> - </exec> -</target> + <!-- Export self-signed certificate --> + <sec:keytool> + <arg value="-keystore"/> + <arg value="${defaultCodeSignerCAKeyStore}"/> + <arg value="-export"/> + <arg value="-alias"/> + <arg value="${aliasSelfKey}"/> + <arg value="-storepass"/> + <arg value="${defaultCAPassword}"/> + <arg value="-file"/> + <arg value="codesigner.cer"/> + </sec:keytool> + </target> -<target name="touchLibs"> - <!-- force that libraries will get signed in a build --> - <touch> - <fileset dir="${dist.lib.dir}" includes="**/*.jar" /> - </touch> -</target> + <target name="touchDistLibs" depends="initCAProperties"> + <!-- force that libraries will get signed in a build --> + <touch> + <fileset dir="${dist.lib.dir}" includes="**/*.jar"/> + </touch> + </target> -<target name="initCA" depends="cleanCA,initCodeSignerCA,initCommunityCA,touchLibs"> -</target> + <target name="initCA" depends="cleanCA,initCodeSignerCA,initCommunityCA,touchDistLibs"> + </target> -<!-- 1.2 Signing a jar file --> -<target name="signjarbuild"> - <signjar jar="${jarname}" - alias="${aliasSelfKey}" - keystore="${CA}/${defaultCodeSignerCAKeyStore}" - signedjar="${signedjarname}" - storepass="${defaultCAPassword}"/> -</target> + <!-- 1.2 Signing a jar file --> + <target name="signjarbuild" depends="ready-to-create-CA"> + <signjar jar="${jarname}" + alias="${aliasSelfKey}" + keystore="${CA}/${defaultCodeSignerCAKeyStore}" + signedjar="${signedjarname}" + storepass="${defaultCAPassword}"/> + </target> -<!-- 1.3.2 Sets a random password in the property defaultPassword --> -<target name="randomPasswd" > - <!-- First generate a file with random characters --> - <exec dir="${dist.private.dir}" executable="openssl"> - <arg line="rand -out ${tempPasswdFile} -base64 15"/> - </exec> - <!-- Second generate a property file with it--> - <echo message="defaultPassword=" file="${dist.private.dir}/header.txt"/> - <concat destfile = "${dist.private.dir}/${tempPasswdFile}.properties"> - <filelist dir="${dist.private.dir}" - files="header.txt,${tempPasswdFile}"/> - </concat> + <!-- 1.3.2 Sets a random password in the property defaultPassword --> + <target name="randomPasswd" depends="ready-to-create-CA"> + <!-- First generate a file with random characters --> + <!--<arg line="rand -out ${tempPasswdFile} -base64 15"/>--> + <sec:openssl dir="${dist.private.dir}"> + <arg value="rand"/> + <arg value="-out"/> + <arg value="${tempPasswdFile}"/> + <arg value="-base64"/> + <arg value="15"/> + </sec:openssl> - <!-- Read property file --> - <property file="${dist.private.dir}/${tempPasswdFile}.properties"/> - <!-- Clean up --> - <delete file="${dist.private.dir}/${tempPasswdFile}.properties"/> - <delete file="${dist.private.dir}/${tempPasswdFile}"/> - <delete file="${dist.private.dir}/header.txt"/> -</target> -<!-- 1.4 Initialize security credentials for new daemon --> -<target name="newDaemon" depends="randomPasswd"> - <!-- Clean old key store, init timestamp --> - <tstamp> - <format property="suffix" pattern="mmss"/> - </tstamp> - <tstamp> - <format property="Unique" pattern="yyyymmddhhmmss"/> - </tstamp> - <property name="daemonFromPrivate" value="${hostDirPrefix}${suffix}"/> - <property name="daemonDir" location="${dist.private.dir}/${hostDirPrefix}${suffix}"/> - <mkdir dir="${daemonDir}"/> + <!-- Second generate a property file with it--> + <echo message="defaultPassword=" file="${dist.private.dir}/header.txt"/> + <concat destfile="${dist.private.dir}/${tempPasswdFile}.properties"> + <filelist dir="${dist.private.dir}" + files="header.txt,${tempPasswdFile}"/> + </concat> - <!-- First generate new keys --> - <genkey alias="${aliasSelfKey}" keystore="${daemonDir}/${defaultKeyStore}" - keyalg="RSA" - storepass="${defaultPassword}" - dname="CN=SmartFrog${Unique}, OU=HPL, O=HP, C=UK"/> - <!-- Generate request for certificate --> - <exec dir="${dist.private.dir}" executable="keytool"> - <arg line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -certreq -alias ${aliasSelfKey} -storepass ${defaultPassword} -file ${CAFromPrivate}/client.crs"/> - </exec> + <!-- Read property file --> + <property file="${dist.private.dir}/${tempPasswdFile}.properties"/> + <!-- Clean up --> + <delete file="${dist.private.dir}/${tempPasswdFile}.properties"/> + <delete file="${dist.private.dir}/${tempPasswdFile}"/> + <delete file="${dist.private.dir}/header.txt"/> + </target> - <!-- Get the CA to sign it --> - <exec dir="${CA}" executable="openssl"> - <arg line="ca -config openssl.cnf -batch -in client.crs -out client.crs.pem -keyfile ca.key -key ${defaultCAPassword} "/> - </exec> + <!-- 1.4 Initialize security credentials for new daemon --> + <target name="newDaemon" depends="randomPasswd,initCAPrograms,ready-to-create-CA"> + <!-- Clean old key store, init timestamp --> + <tstamp> + <format property="suffix" pattern="mmss"/> + </tstamp> + <tstamp> + <format property="Unique" pattern="yyyymmddhhmmss"/> + </tstamp> + <property name="daemonFromPrivate" value="${hostDirPrefix}${suffix}"/> + <property name="daemonDir" location="${dist.private.dir}/${hostDirPrefix}${suffix}"/> + <mkdir dir="${daemonDir}"/> - <!-- Change format to DER--> - <exec dir="${CA}" executable="openssl"> - <arg line="x509 -in client.crs.pem -out client.crs.der -outform DER "/> - </exec> + <!-- First generate new keys --> + <genkey alias="${aliasSelfKey}" + keystore="${daemonDir}/${defaultKeyStore}" + keyalg="RSA" + storepass="${defaultPassword}" + dname="CN=SmartFrog${Unique}, OU=HPL, O=HP, C=UK"/> - <!-- Add public of Community CA to Root of Trust --> - <exec dir="${dist.private.dir}" executable="keytool"> - <arg line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCommunityKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/${CAsubdir}/cacert.pem"/> - </exec> + <!-- Generate request for certificate --> + <sec:keytool dir="${dist.private.dir}"> + <arg value="-keystore"/> + <arg value="${daemonFromPrivate}/${defaultKeyStore}"/> + <arg value="-alias"/> + <arg value="${aliasSelfKey}"/> + <arg value="-certreq"/> + <arg value="-storepass"/> + <arg value="${defaultPassword}"/> + <arg value="-file"/> + <arg value="${CAFromPrivate}/client.crs"/> - <!-- Add certificate to my keys storage --> - <exec dir="${dist.private.dir}" executable="keytool"> - <arg line="-storepass ${defaultPassword} -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasSelfKey} -import -file ${CAFromPrivate}/client.crs.der"/> - </exec> + <!--line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -certreq -alias ${aliasSelfKey} -storepass ${defaultPassword} -file ${CAFromPrivate}/client.crs"--> + </sec:keytool> - <!-- Add public of CodeSigner CA to Root of Trust --> - <exec dir="${dist.private.dir}" executable="keytool"> - <arg line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCSKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/codesigner.cer"/> - </exec> + <!-- Get the CA to sign it --> + <sec:openssl> + <arg value="ca"/> + <arg value="-config"/> + <arg value="openssl.cnf"/> + <arg value="-batch"/> + <arg value="-in"/> + <arg value="client.crs"/> + <arg value="-out"/> + <arg value="client.crs.pem"/> + <arg value="-keyfile"/> + <arg value="ca.key"/> + <arg value="-key"/> + <arg value="${defaultCAPassword}"/> + <!-- + <arg + line="ca -config openssl.cnf -batch -in client.crs -out client.crs.pem -keyfile ca.key -key ${defaultCAPassword} "/> + --> + </sec:openssl> - <!-- Create ad-hoc security properties file --> - <copy file="${dist.private.dir}/${defaultSecProp}" tofile="${daemonDir}/${defaultSecProp}"/> - <propertyfile file="${daemonDir}/${defaultSecProp}"> - <entry key="org.smartfrog.sfcore.security.keyStorePassword" value="${defaultPassword}"/> - </propertyfile> + <!-- Change format to DER--> -</target> -<!-- 1.5 Clean all the CA stuff --> + <!-- + <exec dir="${CA}" executable="openssl"> + <arg line="x509 -in client.crs.pem -out client.crs.der -outform DER "/> + </exec> + --> -<target name="cleanCA" description=" Cleans the Certificate Authority"> - <delete dir="${CA}/${CAsubdir}"/> + <sec:openssl> + <arg value="x509"/> + <arg value="-in"/> + <arg value="client.crs.pem"/> + <arg value="-out"/> + <arg value="client.crs.der"/> + <arg value="-outform"/> + <arg value="DER"/> + </sec:openssl> + + <!-- Add public of Community CA to Root of Trust --> + <!-- + -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCommunityKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/${CAsubdir}/cacert.pem + --> + <sec:keytool dir="${dist.private.dir}"> + <arg value="-keystore"/> + <arg value="${daemonFromPrivate}/${defaultKeyStore}"/> + <arg value="-alias"/> + <arg value="${aliasCommunityKey}"/> + <arg value="-import"/> + <arg value="-noprompt"/> + <arg value="-storepass"/> + <arg value="${defaultPassword}"/> + <arg value="-file"/> + <arg value="${CAFromPrivate}/${CAsubdir}/cacert.pem"/> + </sec:keytool> + + <!-- Add certificate to my keys storage --> + <!-- + line="-storepass ${defaultPassword} -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasSelfKey} -import -file ${CAFromPrivate}/client.crs.der"/> + --> + <sec:keytool dir="${dist.private.dir}"> + <arg value="-keystore"/> + <arg value="${daemonFromPrivate}/${defaultKeyStore}"/> + <arg value="-alias"/> + <arg value="${aliasSelfKey}"/> + <arg value="-import"/> + <arg value="-storepass"/> + <arg value="${defaultPassword}"/> + <arg value="-file"/> + <arg value="${CAFromPrivate}/client.crs.der"/> + </sec:keytool> + + <!-- Add public of CodeSigner CA to Root of Trust --> + <!-- line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCSKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/codesigner.cer"/>--> + <exec dir="${dist.private.dir}" executable="keytool"> + <arg value="-keystore"/> + <arg value="${daemonFromPrivate}/${defaultKeyStore}"/> + <arg value="-alias"/> + <arg value="${aliasCSKey}"/> + <arg value="-import"/> + <arg value="-noprompt"/> + <arg value="-storepass"/> + <arg value="${defaultPassword}"/> + <arg value="-file"/> + <arg value="${CAFromPrivate}/codesigner.cer"/> + </exec> + + + <!-- Create ad-hoc security properties file --> + <copy file="${dist.private.dir}/${defaultSecProp}" tofile="${daemonDir}/${defaultSecProp}"/> + <propertyfile file="${daemonDir}/${defaultSecProp}"> + <entry key="org.smartfrog.sfcore.security.keyStorePassword" value="${defaultPassword}"/> + </propertyfile> + + </target> + + <!-- 1.5 Clean all the CA stuff --> + + <target name="cleanCA" description=" Cleans the Certificate Authority" + depends="initCAProperties"> + <delete dir="${CA}/${CAsubdir}"/> <delete file="${CA}/cacert.pem"/> <delete file="${CA}/codesigner.cer"/> <delete file="${CA}/codesigner.st"/> @@ -216,37 +403,27 @@ <fileset dir="${dist.private.dir}" includes="host*"/> </delete> <delete file="${CA}/client.crs.pem"/> -</target> + </target> -<!-- 1.6 Dummy CA initialization when openssl is not available --> -<target name="dummyInitCA" depends="cleanCA,touchLibs" description="Initialise a dummy CA"> - <copy todir="${dist.private.dir}"> - <fileset dir="${disttestCA}"> - <include name = "host*/*" /> - </fileset> + <!-- 1.6 Dummy CA initialization when openssl is not available --> + <target name="dummyInitCA" + depends="cleanCA,touchDistLibs" + description="Initialise a dummy CA"> + <copy todir="${dist.private.dir}"> + <fileset dir="${disttestCA}"> + <include name="host*/*"/> + </fileset> </copy> <copy file="${disttestCA}/${defaultCodeSignerCAKeyStore}" - todir="${CA}" /> -</target> + todir="${CA}"/> + </target> -<!-- 1.7 Sign jars, need to edit to change what is signed --> -<target name="signJars" depends="generateversion"> - <antcall target="signjarbuild"> - <param name="jarname" value="${dist.lib.dir}/smartfrog-${Version}.jar"/> - <param name="signedjarname" value="${dist.signedLib.dir}/smartfrog-${Version}.jar"/> - </antcall> - <antcall target="signjarbuild"> - <param name="jarname" value="${dist.lib.dir}/sfExamples-${Version}.jar"/> - <param name="signedjarname" value="${dist.signedLib.dir}/sfExamples-${Version}.jar"/> - </antcall> + <!-- 1.7 Sign jars --> + <target name="signJars" depends="generateversion,initCAPrograms"> + <sec:signsfjar name="smartfrog-${Version}.jar"/> + <sec:signsfjar name="sfExamples-${Version}.jar"/> + <sec:signsfjar name="sfServices-${Version}.jar"/> + </target> - <antcall target="signjarbuild"> - <param name="jarname" value="${dist.lib.dir}/sfServices-${Version}.jar"/> - <param name="signedjarname" value="${dist.signedLib.dir}/sfServices-${Version}.jar"/> - </antcall> - - <!-- don't sign those considered insecure, or not required --> - <!-- - --> -</target> +</project> Modified: trunk/core/smartfrog/releaseBuild.xml =================================================================== --- trunk/core/smartfrog/releaseBuild.xml 2007-03-22 16:59:42 UTC (rev 4006) +++ trunk/core/smartfrog/releaseBuild.xml 2007-03-22 17:00:24 UTC (rev 4007) @@ -60,9 +60,11 @@ <!-- =================================================================== --> <target name="init"> <property name="Name" value="SmartFrog"/> + <tstamp> + <format property="year" pattern="yyyy"/> + </tstamp> <property name="name" value="(C) Copyright 1998-2007 Hewlett-Packard Development Company, LP"/> <property name="version" value="DIST"/> - <property name="year" value=""/> <echo message=""/> <echo message="==================================================================="/> <echo message="= ${Name} ${version}"/> @@ -104,40 +106,31 @@ <!-- =================================================================== --> <!-- Global properties --> <!-- =================================================================== --> - <property name="dist" value="."/> - <property name="bin" value="bin"/> - <property name="lib" value="lib"/> - <property name="testCA" value="testCA"/> - <property name="signedLib" value="signedLib"/> <!-- dir to export jar files --> - <property name="private" value="private"/> <!-- all protected files --> - <property name="build" value="classes"/> <!-- all protected files --> - <property name="src" value="src"/> <!-- all protected files --> - <property name="debugmode" value="on"/> <!-- turn on compile -g --> - <property name="jdocs" value="jdocs"/> - <property name="dist.lib.dir" location="${dist}/${lib}"/> - <property name="rmic.compiler" value="sun"/> - <!-- Sercurity related files --> - <property name="manifestName" value="${private}/sealManifest.mf"/> + <property name="dist" value="."/> + <property name="bin" value="bin"/> + <property name="lib" value="lib"/> + <property name="testCA" value="testCA"/> + <property name="signedLib" value="signedLib"/> <!-- dir to export jar files --> + <property name="private" value="private"/> <!-- all protected files --> + <property name="build" value="classes"/> <!-- all protected files --> + <property name="src" value="src"/> <!-- all protected files --> + <property name="debugmode" value="on"/> <!-- turn on compile -g --> + <property name="jdocs" value="jdocs"/> + <property name="dist.lib.dir" location="${dist}/${lib}"/> + <property name="rmic.compiler" value="sun"/> + <!-- Sercurity related files --> + <property name="manifestName" value="${private}/sealManifest.mf"/> -<!-- Include here the security-related ant file --> -&security; -<!-- End of security-related ant file --> + <!-- ================================================================== --> + <!-- Import the security-related ant file --> + <!-- ================================================================== --> + <import file="private/buildSecurity.xml"/> <!-- =================================================================== --> - <!-- Initialization path (Libs needed for compiling) --> - <!-- =================================================================== --> - <!--path id="smartfrog.class.path"> - <pathelement path="${classpath}"/> - <pathelement location="lib/smartfrog-${Version}.jar"/> - <pathelement location="lib/sfServices-${Version}.jar"/> - <pathelement location="lib/sfExamples-${Version}.jar"/> - </path--> - - <!-- =================================================================== --> <!-- Creates directories --> <!-- =================================================================== --> <target name="initbuild" depends="init"> - <mkdir dir="${build}"/> + <mkdir dir="${build}"/> </target> @@ -198,7 +191,7 @@ <!-- =================================================================== --> <target name="build" depends="copyFiles,initbuild,generateversion" description="Compiles source code"> <!-- Compile the java code from ${src} into ${build} --> - <javac srcdir="${src}" destdir="${build}" debug="${debugmode}" compiler="javac1.4" source="1.4"> + <javac srcdir="${src}" destdir="${build}" debug="${debugmode}" source="1.4"> <!--classpath refid="smartfrog.class.path"/--> <classpath> <pathelement path="${classpath}"/> @@ -236,16 +229,17 @@ <!-- running Version.java to generate version information --> <!-- ================================================================== --> <target name="generateversion" depends="init"> - <java classname="org.smartfrog.Version" - failonerror="true" fork="true" - outputproperty="Version"> - <arg value="-b"/> - <classpath> - <fileset dir="${dist.lib.dir}"> - <include name="**/*.jar"/> - </fileset> - </classpath> - </java> + <java classname="org.smartfrog.Version" + failonerror="true" + fork="true" + outputproperty="Version"> + <arg value="-b"/> + <classpath> + <fileset dir="${dist.lib.dir}"> + <include name="**/*.jar"/> + </fileset> + </classpath> + </java> </target> <!-- =================================================================== --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-03-23 12:50:03
|
Revision: 4010 http://svn.sourceforge.net/smartfrog/?rev=4010&view=rev Author: steve_l Date: 2007-03-23 05:49:55 -0700 (Fri, 23 Mar 2007) Log Message: ----------- SFOS-60: RunShell component runs shell upon sfDeploy() The component now be set to start early (with startEarly true;) or not (startEarly false), in which case the application is only started during sfStart() rather than sfDeploy() The default behaviour has been switched so that 1. ExecuteProgram sets startEarly false 2. RunShell reverts that to startEarly true 3. Java sets startEarly false The result is that components that start native or java programs get started in sfStart, while shell scripts default to starting the shell early, but holding off issuing commands until later. Modified Paths: -------------- trunk/core/smartfrog/docs/components/java.sxw trunk/core/smartfrog/docs/sfShellScript.sxw trunk/core/smartfrog/src/org/smartfrog/services/os/java/components.sf trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShell.java trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShellImpl.java trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/components.sf Modified: trunk/core/smartfrog/docs/components/java.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfShellScript.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/src/org/smartfrog/services/os/java/components.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/os/java/components.sf 2007-03-23 10:12:40 UTC (rev 4009) +++ trunk/core/smartfrog/src/org/smartfrog/services/os/java/components.sf 2007-03-23 12:49:55 UTC (rev 4010) @@ -84,6 +84,8 @@ endorsedDirs []; environment []; jvmargs []; + //force run this late + startEarly false; //bind the shell command to the jvm command shellCmd ATTRIB jvm; shouldDetach false; Modified: trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShell.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShell.java 2007-03-23 10:12:40 UTC (rev 4009) +++ trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShell.java 2007-03-23 12:49:55 UTC (rev 4010) @@ -114,6 +114,12 @@ String varPrintCommandOnFailure = "printCommandOnFailure"; /** + * start the shell on sfDeploy() rather than sfStart() + * {@value} + */ + String varStartEarly = "startEarly"; + + /** * Executes the given command. * * @param cmd command to be exceuted Modified: trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShellImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShellImpl.java 2007-03-23 10:12:40 UTC (rev 4009) +++ trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/RunShellImpl.java 2007-03-23 12:49:55 UTC (rev 4010) @@ -30,6 +30,7 @@ import org.smartfrog.sfcore.common.SmartFrogLifecycleException; import org.smartfrog.sfcore.common.SmartFrogResolutionException; import org.smartfrog.sfcore.common.TerminatorThread; +import org.smartfrog.sfcore.common.SmartFrogRuntimeException; import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.prim.PrimImpl; import org.smartfrog.sfcore.prim.TerminationRecord; @@ -73,6 +74,8 @@ //desired + private boolean startEarly =false; + /** * The String for working directory. */ @@ -167,68 +170,80 @@ * @exception RemoteException In case of network/rmi error */ public synchronized void sfDeploy() throws SmartFrogException, - RemoteException { - try { - super.sfDeploy(); - helper=new ComponentHelper(this); - log=sfLog(); - readSFAttributes(); - - //Create subProcess - File workDirFile = new File(workDir); - String[] commands = createCmd(shellPrefix, shellCommand, shellCommandAtt); - if (log.isDebugEnabled()) { - fullShellCommand = arrayToString(commands, " '", "'\n"); - StringBuffer buffer=new StringBuffer(); - buffer.append("Running in dir "); - buffer.append(workDirFile); - buffer.append('\n'); - buffer.append(fullShellCommand); - log.debug(buffer); + RemoteException { + super.sfDeploy(); + helper = new ComponentHelper(this); + log = sfLog(); + readSFAttributes(); + if (startEarly) { + try { + execute(); + } catch (Throwable t) { + throw SmartFrogLifecycleException.sfDeploy(t.getMessage(), t, this); } - fullShellCommand = arrayToString(commands, " '", "' "); - subProcess = runtime.exec( - commands, - envProp, - workDirFile); - dos = new DataOutputStream(subProcess.getOutputStream()); + } + } - StreamGobbler outputGobbler; - StreamGobbler errorGobbler; - OutputStream outputStream = null; - // any output? - if (outputStreamObj != null) { - outputStream = outputStreamObj.getOutputStream(); - } - outputGobbler = new StreamGobbler(subProcess.getInputStream(), - "[" + getNotifierId() + "] " + "OUT", - outputStream, printMsgImp); - // any error message? - if (errorStreamObj != null) { - outputStream = errorStreamObj.getOutputStream(); - } else { - outputStream = null; - } - errorGobbler = new StreamGobbler(subProcess.getErrorStream(), - "[" + getNotifierId() + "] " + "ERR", - outputStream, printErrMsgImp); + /** + * This is the method that does the excution + * @throws IOException + * @throws SmartFrogRuntimeException + */ + private void execute() throws IOException, SmartFrogRuntimeException { + //Create subProcess + File workDirFile = new File(workDir); + String[] commands = createCmd(shellPrefix, shellCommand, shellCommandAtt); + if (log.isDebugEnabled()) { + fullShellCommand = arrayToString(commands, " '", "'\n"); + StringBuffer buffer=new StringBuffer(); + buffer.append("Running in dir "); + buffer.append(workDirFile); + buffer.append('\n'); + buffer.append(fullShellCommand); + log.debug(buffer); + } + fullShellCommand = arrayToString(commands, " '", "' "); + subProcess = runtime.exec( + commands, + envProp, + workDirFile); + dos = new DataOutputStream(subProcess.getOutputStream()); - errorGobbler.setPassType(false); - outputGobbler.setPassType(false); + StreamGobbler outputGobbler; + StreamGobbler errorGobbler; + OutputStream outputStream = null; - // kick them off - errorGobbler.start(); - outputGobbler.start(); - thread = new Thread(this); + // any output? + if (outputStreamObj != null) { + outputStream = outputStreamObj.getOutputStream(); + } + outputGobbler = new StreamGobbler(subProcess.getInputStream(), + "[" + getNotifierId() + "] " + "OUT", + outputStream, printMsgImp); - //Start listener - thread.start(); - sfReplaceAttribute(varStatus, "deployed"); - } catch (Throwable t) { - throw SmartFrogLifecycleException.sfDeploy(t.getMessage(),t,this); + // any error message? + if (errorStreamObj != null) { + outputStream = errorStreamObj.getOutputStream(); + } else { + outputStream = null; } + errorGobbler = new StreamGobbler(subProcess.getErrorStream(), + "[" + getNotifierId() + "] " + "ERR", + outputStream, printErrMsgImp); + + errorGobbler.setPassType(false); + outputGobbler.setPassType(false); + + // kick them off + errorGobbler.start(); + outputGobbler.start(); + thread = new Thread(this); + + //Start listener + thread.start(); + sfReplaceAttribute(varStatus, "deployed"); } /** @@ -338,18 +353,16 @@ } processName = sfResolve(varSFProcessName,processName,true); - + startEarly =sfResolve(varStartEarly, startEarly,true); outputStreamObj = (OutputStreamIntf) sfResolve(varOutputStreamTo, outputStreamObj , false); errorStreamObj = (StreamIntf) sfResolve(varErrorStreamTo, errorStreamObj , false); printMsgImp = (PrintMsgInt) sfResolve(varOutputMsgTo, printMsgImp , false); printErrMsgImp = (PrintErrMsgInt) sfResolve(varErrorMsgTo, printErrMsgImp , false); printCommandOnFailure = sfResolve(varPrintCommandOnFailure,false,true); - } - /** * This sets a flag that will start the httpd process running. * @@ -359,6 +372,13 @@ public synchronized void sfStart() throws SmartFrogException,RemoteException { super.sfStart(); + if (!startEarly) { + try { + execute(); + } catch (Throwable t) { + throw SmartFrogLifecycleException.sfStart(t.getMessage(), t, this); + } + } sfReplaceAttribute(varStatus, STATUS_RUNNING); execBatch(cmds); } Modified: trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/components.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/components.sf 2007-03-23 10:12:40 UTC (rev 4009) +++ trunk/core/smartfrog/src/org/smartfrog/services/os/runshell/components.sf 2007-03-23 12:49:55 UTC (rev 4010) @@ -35,6 +35,9 @@ printStack extends OptionalBoolean; processID extends OptionalString; processName extends String; + startEarly extends Boolean { + description "set to true to start the program when the component is deployed, rather than when it is started"; + } shellCmd extends String; shouldDetach extends OptionalBoolean; shouldTerminate extends OptionalBoolean { @@ -75,6 +78,7 @@ logLevel 2; printCommandOnFailure false; printStack false; + startEarly false; //also, every nested element beginnng with shellCmdAtt //will be added to the list of arguments *after* the shellArguments vector //and every nested element beginnng with shellCmdAtt and ending in 'b' @@ -110,9 +114,11 @@ // cmdBatch ["cd ..",cd -","ls"]; exitCmd "exit 0"; + startEarly true; useExitCmd true; // Should I use exitCmd at the end of the script? terminateOnFailure false; + //outputMsgTo obj // Object that implements org.smartfrog.services.display.PrintMsgInt //services.display.SFDisplay uses it //errorMsgTo obj // Object that implements org.smartfrog.services.display.PrintErrMsgInt //services.display.SFDisplay uses it //outputStreamTo // Object that implements org.smartfrog.services.utils..OutputStreamIntf This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-07-05 14:37:18
|
Revision: 4567 http://svn.sourceforge.net/smartfrog/?rev=4567&view=rev Author: steve_l Date: 2007-07-05 07:37:09 -0700 (Thu, 05 Jul 2007) Log Message: ----------- SFOS-245 generating release artifacts without sfgui or similar Modified Paths: -------------- trunk/core/smartfrog/bin/default.ini trunk/core/smartfrog/build.xml trunk/core/smartfrog/buildRelease.xml trunk/core/smartfrog/docs/sfQuickRef.pdf trunk/core/smartfrog/docs/sfQuickRef.sxw trunk/core/smartfrog/docs/sfReference.pdf trunk/core/smartfrog/docs/sfReference.sxw trunk/core/smartfrog/docs/sfUserManual.pdf trunk/core/smartfrog/docs/sfUserManual.sxw Removed Paths: ------------- trunk/core/smartfrog/lib/SFGuiBrowser.jar trunk/core/smartfrog/lib/SFGuiTools.jar Modified: trunk/core/smartfrog/bin/default.ini =================================================================== --- trunk/core/smartfrog/bin/default.ini 2007-07-05 13:49:32 UTC (rev 4566) +++ trunk/core/smartfrog/bin/default.ini 2007-07-05 14:37:09 UTC (rev 4567) @@ -25,13 +25,13 @@ #------------------------------------------------------------------------------ # Logging properties. Examples. #------------------------------------------------------------------------------ -# Optional property to define the initial local logg level +# Optional property to define the initial local log level # Default level: 3 - LOG_LEVEL_INFO; # 0 - IGNORE(ALL); 1- TRACE; 2- DEBUG; 3- INFO(default); 4- WARN; 5- ERROR; 6- FATAL; 7- NONE -# org.smartfrog.sfcore.logging.LogImpl.logLevel=2 + org.smartfrog.sfcore.logging.LogImpl.logLevel=2 # Optional boolean property to include stack trace with error message -# org.smartfrog.sfcore.common.Logger.logStackTrace=true + org.smartfrog.sfcore.common.Logger.logStackTrace=true # Optional boolean property to check java nslookup # org.smartfrog.sfcore.common.Logger.testNetwork=false @@ -41,29 +41,29 @@ # org.smartfrog.sfcore.common.Logger.processCompoundDiagnosticsReport=true # Optional property to define the initial local logger - Default: LogToStreamsImpl -# org.smartfrog.sfcore.logging.LogImpl.loggerClass=org.smartfrog.sfcore.logging.LogToStreamsImpl + org.smartfrog.sfcore.logging.LogImpl.loggerClass=org.smartfrog.sfcore.logging.LogToStreamsImpl # org.smartfrog.sfcore.logging.LogImpl.loggerClass=org.smartfrog.sfcore.logging.LogToFileImpl # org.smartfrog.sfcore.logging.LogImpl.loggerClass=org.smartfrog.sfcore.logging.LogToNothingImpl # org.smartfrog.sfcore.logging.LogImpl.loggerClass=org.smartfrog.services.logging.log4j.LogToLog4JImpl - org.smartfrog.sfcore.logging.LogImpl.loggerClass=[|"org.smartfrog.sfcore.logging.LogToStreamsImpl","org.smartfrog.sfcore.logging.LogToFileImpl"|] +# org.smartfrog.sfcore.logging.LogImpl.loggerClass=[|"org.smartfrog.sfcore.logging.LogToStreamsImpl","org.smartfrog.sfcore.logging.LogToFileImpl"|] # Optional properties LogToStreamsImpl # org.smartfrog.sfcore.logging.LogToStreamsImpl.showMethodCall=false # org.smartfrog.sfcore.logging.LogToStreamsImpl.showDateTime=false -# org.smartfrog.sfcore.logging.LogToStreamsImpl.dateFormat=yyyy/MM/dd HH:mm:ss:SSS zzz +# org.smartfrog.sfcore.logging.LogToStreamsImpl.dateFormat=yyyy-MM-dd HH:mm:ss:SSS zzz # Optional properties for LogToFileImpl (default path = java.io.tmpdir) # org.smartfrog.sfcore.logging.LogToFileImpl.path="./log" # org.smartfrog.sfcore.logging.LogToFileImpl.showMethodCall=true # org.smartfrog.sfcore.logging.LogToFileImpl.showDateTime=true -# org.smartfrog.sfcore.logging.LogToFileImpl.dateFormat=yyyy/MM/dd HH:mm:ss:SSS zzz +# org.smartfrog.sfcore.logging.LogToFileImpl.dateFormat=yyyy-MM-dd HH:mm:ss:SSS zzz # org.smartfrog.sfcore.logging.LogToFileImpl.fileNamePrefix="PreFiX" # org.smartfrog.sfcore.logging.LogToFileImpl.logFileExtension="sf.log" # org.smartfrog.sfcore.logging.LogToFileImpl.useLogNameInFileName=true # org.smartfrog.sfcore.logging.LogToFileImpl.useHostNameInFileName=true # org.smartfrog.sfcore.logging.LogToFileImpl.useProcessNameInFileName=true # org.smartfrog.sfcore.logging.LogToFileImpl.useDatedFileName=true -# org.smartfrog.sfcore.logging.LogToFileImpl.fileNameDateFormat="yyyyMMdd-HHmmss_SSSzzz +# org.smartfrog.sfcore.logging.LogToFileImpl.fileNameDateFormat="yyyy-MM-dd-HHmmss_SSSzzz # org.smartfrog.sfcore.logging.LogToFileImpl.redirectSystemOutputs=false # org.smartfrog.sfcore.logging.LogToFileImpl.append=true @@ -78,5 +78,5 @@ #------------------------------------------------------------------------------ # Optional System Properties #------------------------------------------------------------------------------ -# Use system proxy - Only effective since Java 1.5 +# Use system proxy - Only effective since Java 1.5, and somewhat temperamental # java.net.useSystemProxies=true Modified: trunk/core/smartfrog/build.xml =================================================================== --- trunk/core/smartfrog/build.xml 2007-07-05 13:49:32 UTC (rev 4566) +++ trunk/core/smartfrog/build.xml 2007-07-05 14:37:09 UTC (rev 4567) @@ -34,7 +34,7 @@ For JavaCC, download it from https://javacc.dev.java.net/ and install the relevant JAR files into the javacc subdirectory -</description> + </description> @@ -258,6 +258,7 @@ <!-- =================================================================== --> <target name="release" depends="clean, dist,jdocs, generatedoc" description="Creates clean new release"/> + <!-- =================================================================== --> <!-- --> <!-- =================================================================== --> @@ -807,7 +808,6 @@ </filterchain> </copy> </presetdef> - </target> @@ -925,7 +925,7 @@ <copy file="${sf-examples.jar}" todir="${artifacts.dir}" /> </target> - <target name="ready-to-publish" depends="copy-target-jars,ivy-report,package-install-artifact"/> + <target name="ready-to-publish" depends="copy-target-jars,ivy-report,unzip-install-artifact"/> <target name="ivy-publish" depends="ready-to-publish" if="ivy.found"> <ivy:publish resolver="local" pubrevision="${Version}" @@ -957,19 +957,51 @@ </zip> </target> - <!--the install artifact is a snapshot of the dist tree--> + <!-- + the install artifact is the core com + --> <target name="package-install-artifact" depends="artifact-names,ready-to-dist"> <zip destfile="${sf-core-install.zip}"> - <zipfileset dir="${dist.dir}" includes="**/*"/> + <zipfileset dir="${dist.dir}" > + <include name="**/*" /> + <exclude name="lib/*" /> + <exclude name="bin/sfGui*" /> + </zipfileset> + <zipfileset dir="${dist.dir}/lib" prefix="lib"> + <include name="${smartfrog.stub}.*" /> + <include name="${sf-services.stub}.*" /> + <include name="${sf-examples.stub}.*" /> + </zipfileset> </zip> </target> - <target name="unzip-install-artifact" depends="package-install-artifact" > - <unzip src="${sf-core-install.zip}" dest="${artifacts.dir}/install"/> + <target name="unzip-install-artifact" depends="package-install-artifact,declare-assertions" > + <property name="unzip.install.dir" location="${artifacts.dir}/install" /> + <unzip src="${sf-core-install.zip}" dest="${unzip.install.dir}"/> + <fileexists file="${unzip.install.dir}/lib/${smartfrog.stub}.jar" /> + <fileexists file="${unzip.install.dir}/lib/${sf-services.stub}.jar" /> + <fileexists file="${unzip.install.dir}/lib/${sf-examples.stub}.jar" /> </target> <target name="publish-all" depends="published" /> + <!--declare some useful assertions--> + <target name="declare-assertions"> + <macrodef name="fileexists"> + <attribute name="file"/> + <sequential > + <fail> + <condition> + <not> + <available file="@{file}" /> + </not> + </condition> + Missing file:@{file} + </fail> + </sequential> + </macrodef> + </target> + <!-- ========================================================== --> <!-- print meaningful diagnostics --> <!-- ========================================================== --> Modified: trunk/core/smartfrog/buildRelease.xml =================================================================== --- trunk/core/smartfrog/buildRelease.xml 2007-07-05 13:49:32 UTC (rev 4566) +++ trunk/core/smartfrog/buildRelease.xml 2007-07-05 14:37:09 UTC (rev 4567) @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<project name="kernel-release" default="process" basedir="."> +<project name="kernel-release" default="release" basedir="."> <!-- /** (C) Copyright 1998-2007 Hewlett-Packard Development Company, LP @@ -30,8 +30,19 @@ ============ To use: ant -f buildRelease release + set gui.enabled=true to include smartfrog gui components + set tasks.enabled=true to include the tasks + set logging.enabled=true to include logging </description> + + <!--look for two override points--> + <property file="build.properties" /> + <property file="../build.properties" /> + + + + <!-- =================================================================== --> <!-- Initialization target --> <!-- =================================================================== --> @@ -47,6 +58,29 @@ <echo message=""/> <echo message="==================================================================="/> <echo message="In the kernel-release project"/> + + <!--a macro that defaults to not setting a property include.name + unless the property name.enabled is already set. + --> + + <macrodef name="disable"> + <attribute name="name"/> + <sequential> + <property name="@{name}.enabled" value="false" /> + <condition property="include.@{name}"> + <istrue value="${@{name}.enabled}" /> + </condition> + <echo level="verbose">include.@{name}=${include.@{name}}</echo> + </sequential> + </macrodef> + + <!--we cannot drop the gui until it builds and publishes under Ivy --> + <!--<property name="gui.enabled" value="true" />--> + <disable name="gui" /> + + <!--logging and tasks, they are under control--> + <disable name="logging" /> + <disable name="tasks" /> </target> <!-- =================================================================== --> @@ -135,6 +169,8 @@ <property name="dos-executables" value="**/*.bat,**/*.cmd"/> + + <!-- =================================================================== --> <!-- define the patterns for different parts of the archives --> <!-- patterns are not bound to a specific directory, so can be reused --> @@ -158,6 +194,7 @@ <include name="*.py"/> <exclude name="*.bat"/> <exclude name="*.cmd"/> + <exclude name="sfGui" unless="include.gui" /> <patternset refid="excluded.cruft"/> </patternset> @@ -165,6 +202,7 @@ <patternset id="dos.bin"> <include name="*.bat"/> <include name="*.cmd"/> + <exclude name="sfGUI*.bat" unless="include.gui" /> </patternset> <!--everything in the bin dir other than the unix and DOS stuff--> @@ -220,14 +258,23 @@ <patternset refid="excluded.cruft"/> </patternset> + <patternset id="lib.pattern"> - <include name="lib/**/*.jar"/> + <include name="smartfrog*.jar"/> + <include name="sfServices*.jar"/> + <include name="sfExamples*.jar"/> + <exclude name="SFGuiTools*.jar" unless="include.gui" /> + <exclude name="SFGuiBrowser*.jar" unless="include.gui" /> + <exclude name="sf-loggingservices*.jar" unless="include.logging"/> + <exclude name="log4j-*.jar" unless="include.logging"/> + <exclude name="commons-logging-*.jar" unless="include.logging"/> + <exclude name="sf-tasks*.jar" unless="include.tasks" /> </patternset> - <target name="clean" > <delete dir="${release.dir}" /> </target> + <!-- =================================================================== --> <!-- FixCRLF for different platforms --> <!-- =================================================================== --> @@ -276,19 +323,6 @@ </fileset> </classpath> </java> - <!--copy todir="${dist.lib.dir}"> - <fileset dir="${dist.lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <mapper type="glob" from="*.jar" to="*-${version}.jar"/> - </copy--> - - <!--copy todir="${lib}"> - <fileset dir="${lib}"> - <include name="**/*.jar"/> - </fileset> - <mapper type="glob" from="*.jar" to="*-${version}.jar"/> - </copy--> </target> <target name="ready-to-release" depends="init, initrelease, fixCRLF" > @@ -321,7 +355,7 @@ <!-- distributables. Leaves out but docs but includes binaries without setting permissions--> <zipfileset id="dist.main.zf" dir="${dist}" prefix="${prefix}/dist"> <include name="**"/> - <!--exclude name="lib/**"/--> + <exclude name="lib/**" /> <exclude name="bin/**"/> <exclude name="docs/**"/> <exclude name="classes/**"/> @@ -365,20 +399,17 @@ prefix="${prefix}/bin"> <patternset refid="other.bin" /> </zipfileset> - <zipfileset id="lib.zf" dir="lib" - prefix="${prefix}/lib"> - <patternset refid="other.bin" /> - </zipfileset> - <zipfileset id="other.bin.zf" dir="bin" - prefix="${prefix}/bin"> - <patternset refid="other.bin" /> - </zipfileset> <!-- source --> <zipfileset id="main.zf" dir="." prefix="${prefix}/"> <patternset refid="source.pattern" /> </zipfileset> - <zipfileset id="lib.zf" dir="." + + <zipfileset id="dist.lib.zf" dir="${dist}/lib" + prefix="${prefix}/dist/lib"> + <patternset refid="lib.pattern" /> + </zipfileset> + <zipfileset id="lib.zf" dir="lib" prefix="${prefix}/lib"> <patternset refid="lib.pattern" /> </zipfileset> @@ -391,6 +422,7 @@ <zipfileset refid="dist.unix.bin.zf" /> <zipfileset refid="dist.dos.bin.zf" /> <zipfileset refid="dist.other.bin.zf" /> + <zipfileset refid="dist.lib.zf" /> <zipfileset refid="security.unix.bin.zf" /> <zipfileset refid="security.dos.bin.zf" /> <zipfileset refid="security.other.bin.zf" /> @@ -413,6 +445,8 @@ <target name="all-zip" depends="zipfilesets" description="all zip"> + + <!--extend the dist file with extra stuff--> <make-dist-zip destfile="${all.zip}" > <zipfileset refid="doc.files.zf"/> @@ -449,10 +483,10 @@ prefix="${prefix}/dist/docs"> <patternset refid="docs.pattern" /> </tarfileset> - <!-- distributables. Leaves out but docs but includes binaries without setting permissions--> + <!-- distributables. Leaves out docs, lib and binaries--> <tarfileset id="dist.main.tf" dir="${dist}" prefix="${prefix}/dist"> <include name="**"/> - <!--exclude name="lib/**"/--> + <exclude name="lib/**"/> <exclude name="bin/**"/> <exclude name="docs/**"/> <exclude name="classes/**"/> @@ -492,29 +526,24 @@ prefix="${prefix}/bin"> <patternset refid="other.bin" /> </tarfileset> - <tarfileset id="lib.tf" dir="lib" - prefix="${prefix}/lib"> - <patternset refid="other.bin" /> - </tarfileset> <tarfileset id="dos.bin.tf" dir="bin" prefix="${prefix}/bin"> <patternset refid="dos.bin" /> </tarfileset> - <tarfileset id="other.bin.tf" dir="bin" - prefix="${prefix}/bin"> - <patternset refid="other.bin" /> - </tarfileset> <!-- source --> <tarfileset id="main.tf" dir="." prefix="${prefix}/"> <patternset refid="source.pattern" /> </tarfileset> - <tarfileset id="lib.tf" dir="." + <tarfileset id="dist.lib.tf" dir="${dist}/lib" + prefix="${prefix}/dist/lib"> + <patternset refid="lib.pattern" /> + </tarfileset> + <tarfileset id="lib.tf" dir="lib" prefix="${prefix}/lib"> <patternset refid="lib.pattern" /> </tarfileset> - <presetdef name="make-dist-tar"> <tar longfile="gnu" > <tarfileset refid="dist.main.tf" /> @@ -522,6 +551,7 @@ <tarfileset refid="dist.unix.bin.tf" /> <tarfileset refid="dist.dos.bin.tf" /> <tarfileset refid="dist.other.bin.tf" /> + <tarfileset refid="dist.lib.tf" /> <tarfileset refid="security.unix.bin.tf" /> <tarfileset refid="security.dos.bin.tf" /> <tarfileset refid="security.other.bin.tf" /> @@ -577,14 +607,14 @@ <!-- =================================================================== --> <!-- release --> <!-- =================================================================== --> - <target name="release" depends="zip,tar" + <target name="release" depends="zip,tar,expand" description="Creates zip with release packages"> </target> <target name="expand" depends="unzip,untar" description="make the distributables, then expand them" /> - <target name="oldrelease" depends="dist-zip" > + <!-- <target name="oldrelease" depends="dist-zip" > <tar tarfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" > <tarfileset dir="." prefix="${prefix}"> @@ -595,7 +625,6 @@ <tarfileset dir="." prefix="${prefix}" > <exclude name="${dist}/bin/**"/> <include name="${dist}/**"/> - <!--exclude name="${dist}/lib/**"/--> <exclude name="${dist}/classes/**"/> <exclude name="${dist}/docs/**"/> <patternset refid="excluded.cruft"/> @@ -603,9 +632,6 @@ <tarfileset dir="${dist}/docs/" prefix="${prefix}/dist/docs"> <patternset refid="docs.pattern" /> </tarfileset> - <!--tarfileset dir="." prefix="${prefix}"> - <include name="${dist}/lib/**/*-${version}.jar"/> - </tarfileset--> <tarfileset dir="." mode="755" prefix="${prefix}"> <include name="${dist}/bin/**"/> <exclude name="${dist}/bin/**/*.sf"/> @@ -623,8 +649,8 @@ <include name="bin/**/*.bat"/> <include name="bin/**/*.ini"/> <include name="lib/**"/> - <!--include name="lib/*-${version}.jar"/> - <include name="lib/readme.txt"/--> + --><!--include name="lib/*-${version}.jar"/> + <include name="lib/readme.txt"/--><!-- <patternset refid="source.pattern"/> </tarfileset> <tarfileset dir="bin" prefix="${prefix}/bin" mode="755"> @@ -648,14 +674,10 @@ <tarfileset dir="." prefix="${prefix}"> <exclude name="${dist}/bin/**"/> <include name="${dist}/**"/> - <!--exclude name="${dist}/lib/**"/--> <exclude name="${dist}/classes/**"/> <exclude name="${dist}/classes/**"/> <exclude name="${dist}/docs/**"/> </tarfileset> - <!--tarfileset dir="." prefix="${prefix}"> - <include name="${dist}/lib/**/*-${version}.jar"/> - </tarfileset--> <tarfileset dir="." mode="755" prefix="${prefix}"> <include name="${dist}/bin/**"/> <exclude name="${dist}/bin/**/*.sf"/> @@ -665,25 +687,7 @@ </tar> <gzip src="${release.dir}/${prefix}.${DSTAMP}_ALL.tar" zipfile="${release.dir}/${prefix}.${DSTAMP}_ALL.tar.gz"/> <delete file="${release.dir}/${prefix}.${DSTAMP}_ALL.tar"/> -<!-- - <zip destfile="../${prefix}.${DSTAMP}_JDOCS.zip"> - <zipfileset dir="." prefix="${prefix}"> - <include name="${dist}/docs/jdocs/**"/> - </zipfileset> - </zip> - <tar tarfile="../${prefix}.${DSTAMP}_JDOCS.tar" > - <tarfileset dir="." prefix="${prefix}"> - <include name="${dist}/docs/jdocs/**"/> - </tarfileset> - </tar> - <gzip src="../${prefix}.${DSTAMP}_JDOCS.tar" zipfile="../${prefix}.${DSTAMP}_JDOCS.tar.gz"/> - <delete file="../${prefix}.${DSTAMP}_JDOCS.tar"/> - --> - - <!--delete> - <fileset dir="${lib}" includes="**/*-${version}.jar"/> - </delete--> - </target> + </target>--> </project> <!-- End of file --> Modified: trunk/core/smartfrog/docs/sfQuickRef.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfQuickRef.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfReference.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfReference.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfUserManual.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfUserManual.sxw =================================================================== (Binary files differ) Deleted: trunk/core/smartfrog/lib/SFGuiBrowser.jar =================================================================== (Binary files differ) Deleted: trunk/core/smartfrog/lib/SFGuiTools.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2007-07-05 18:28:57
|
Revision: 4578 http://svn.sourceforge.net/smartfrog/?rev=4578&view=rev Author: julgui Date: 2007-07-05 11:28:54 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Solution: replaced DummySecurityManager by normal java security manager when the system property java.securiy.policy is defined. Now for dynamic classloading we need to define: -java.security.policy with the right policies and -Djava.security.manager for the java security manager Therefore: For classloading and no security: Windows: -Djava.security.policy=="%SFHOME%\private\sf.no.security.policy" -Djava.security.manager -Dorg.smartfrog.codebase=%CODEBASE% Unix: "-Djava.security.policy==$SFHOME/private/sf.no.security.policy -Djava.security.manager -Dorg.smartfrog.codebase=$CODEBASE" The policy file: sf.no.security.policy grant everything = no security. If the property "java.security.policy" is not defined no security manager is loaded. See SVN changes for more detail. SFOS-236 Modified Paths: -------------- trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties.bat trunk/core/smartfrog/bin/setSFProperties trunk/core/smartfrog/bin/setSFProperties.bat trunk/core/smartfrog/src/org/smartfrog/SFSystem.java trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java Added Paths: ----------- trunk/core/smartfrog/bin/sf.open.policy Modified: trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties =================================================================== --- trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties 2007-07-05 18:28:54 UTC (rev 4578) @@ -12,7 +12,7 @@ export SERVER=http://localhost:8080 export CODEBASE="$SERVER/sfExamples.jar" -export SFCODEBASE="-Dorg.smartfrog.codebase=$CODEBASE" +export SFCODEBASE="-Djava.security.policy==$SFHOME/private/sf.no.security.policy -Djava.security.manager -Dorg.smartfrog.codebase=$CODEBASE" # -------------------End user properties--------------- Modified: trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties.bat =================================================================== --- trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties.bat 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/bin/setSFDynamicClassLoadingProperties.bat 2007-07-05 18:28:54 UTC (rev 4578) @@ -12,6 +12,6 @@ set SERVER=http://localhost:8080 set CODEBASE="%SERVER%/sfExamples.jar" -set SFCODEBASE="-Dorg.smartfrog.codebase=%CODEBASE%" +set SFCODEBASE=-Djava.security.policy=="%SFHOME%\private\sf.no.security.policy" -Djava.security.manager -Dorg.smartfrog.codebase=%CODEBASE% rem -------------------End user properties------------------------- Modified: trunk/core/smartfrog/bin/setSFProperties =================================================================== --- trunk/core/smartfrog/bin/setSFProperties 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/bin/setSFProperties 2007-07-05 18:28:54 UTC (rev 4578) @@ -57,9 +57,17 @@ if test "$SFSECURITY"; then export SFLIBPATH="$SFHOME/signedLib" fi + +# SF/lib (SF core libs) for i in "$SFLIBPATH"/*.jar; do CLASSPATH=$i:$CLASSPATH; done export CLASSPATH +# SF/lib.ext (external libs used by SF core) +# export SFLIBPATH="$SFHOME/lib.ext" +# for i in "$SFLIBPATH"/*.jar; do CLASSPATH=$i:$CLASSPATH; done +# export CLASSPATH + + if test "$SFUSERHOME"; then export SFLIBPATH="$SFUSERHOME" for i in "$SFLIBPATH"/*.jar; do CLASSPATH=$i:$CLASSPATH; done Modified: trunk/core/smartfrog/bin/setSFProperties.bat =================================================================== --- trunk/core/smartfrog/bin/setSFProperties.bat 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/bin/setSFProperties.bat 2007-07-05 18:28:54 UTC (rev 4578) @@ -42,8 +42,14 @@ rem reset CLASSPATH set CLASSPATH= +rem SF/lib (SF core libs) call "%SFHOME%\bin\setClassPath" +rem SF/lib (SF core libs) +set SFLIBPATH=%SFHOME%\lib.ext +CALL "%SFHOME%\bin\setClassPath" + +rem now user defined classpaths if not defined SFUSERHOME goto continue2 set SFLIBPATH=%SFUSERHOME% CALL "%SFHOME%\bin\setClassPath" Added: trunk/core/smartfrog/bin/sf.open.policy =================================================================== --- trunk/core/smartfrog/bin/sf.open.policy (rev 0) +++ trunk/core/smartfrog/bin/sf.open.policy 2007-07-05 18:28:54 UTC (rev 4578) @@ -0,0 +1,11 @@ +// No security - Everything granted + +grant { + permission java.security.AllPermission; +}; + +// Standard extensions get all permissions by default +grant codeBase "file:${java.home}/lib/ext/*" { + permission java.security.AllPermission; +}; + Modified: trunk/core/smartfrog/src/org/smartfrog/SFSystem.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/SFSystem.java 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/src/org/smartfrog/SFSystem.java 2007-07-05 18:28:54 UTC (rev 4578) @@ -553,19 +553,8 @@ // Read init properties readPropertiesFromIniFile(); sfLog(); - // Notify status of Security - if (!SFSecurity.isSecurityOn()){ - String securityRequired = System.getProperty(SFSecurityProperties.propSecurityRequired,"false"); - Boolean secured=Boolean.valueOf(securityRequired); - if(secured.booleanValue()) { - //we need security, but it is not enabled - throw new SFGeneralSecurityException(MessageUtil.formatMessage(ERROR_NO_SECURITY_BUT_REQUIRED)); - } - if (sfLog().isWarnEnabled()) { - sfLog().warn(MessageUtil.formatMessage(WARN_NO_SECURITY)); - } + notifySecurityStatus(); - } // Init logging properties Logger.init(); @@ -583,6 +572,27 @@ } } + public static void notifySecurityStatus() throws SFGeneralSecurityException { + // Notify status of Security + if (!SFSecurity.isSecurityOn()){ + String securityRequired = System.getProperty(SFSecurityProperties.propSecurityRequired,"false"); + Boolean secured=Boolean.valueOf(securityRequired); + if(secured.booleanValue()) { + //we need security, but it is not enabled + throw new SFGeneralSecurityException(MessageUtil.formatMessage(ERROR_NO_SECURITY_BUT_REQUIRED)); + } + if (sfLog().isWarnEnabled()) { + sfLog().warn(MessageUtil.formatMessage(WARN_NO_SECURITY)); + } + + } + // if this property is set the a sec manager is created + String secPro = System.getProperty("java.security.policy"); + if (secPro!=null ) { + if (sfLog().isDebugEnabled()) sfLog().debug("Using java security policy: "+secPro); + } + } + /** * * @return LogSF Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java 2007-07-05 18:28:54 UTC (rev 4578) @@ -489,6 +489,7 @@ } catch (Exception ex) { out.append("Exception Info:");out.append(ex.toString());out.append("\n"); } + out.append("* \n"); String nameP =System.getProperty("org.smartfrog.iniFile"); if ( nameP!=null){ out.append("* SF ini file: ");out.append(nameP);out.append("\n"); @@ -502,7 +503,17 @@ if ( nameP!=null){ out.append("* SF process name: ");out.append(nameP);out.append("\n"); } + nameP =System.getProperty("java.security.policy"); + if ( nameP!=null){ + out.append("* Java security policy: ");out.append(nameP);out.append("\n"); + } + nameP =System.getProperty("org.smartfrog.codebase"); + if ((nameP!=null)&& !nameP.equals("")){ + out.append("* SF codebase: ");out.append(nameP);out.append("\n"); + } + + } /** Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java 2007-07-05 18:28:54 UTC (rev 4578) @@ -1307,14 +1307,15 @@ } } + // Pass java.security.policy if it is defined + String secProp = props.getProperty("java.security.policy"); + + if (secProp != null) { + cmd.addElement("-Djava.security.policy=" + secProp); + } + if (SFSecurity.isSecurityOn()) { - // Pass java.security.policy - String secProp = props.getProperty("java.security.policy"); - if (secProp != null) { - cmd.addElement("-Djava.security.policy=" + secProp); - } - // org.smartfrog.sfcore.security.propFile secProp = props.getProperty(SFSecurityProperties.propPropertiesFileName); Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2007-07-05 18:05:24 UTC (rev 4577) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2007-07-05 18:28:54 UTC (rev 4578) @@ -63,8 +63,8 @@ try { if (alreadyInit == false) { // Add the new RMIClassLoaderSpi - System.setProperty("java.rmi.server.RMIClassLoaderSpi", - "org.smartfrog.sfcore.security." + "SFRMIClassLoaderSpi"); + System.setProperty("java.rmi.server.RMIClassLoaderSpi", "org.smartfrog.sfcore.security." + "SFRMIClassLoaderSpi"); + SFSecurityProperties.readSecurityProperties(); if (Boolean.getBoolean(SFSecurityProperties.propSecurityOn)) { @@ -115,13 +115,15 @@ RMISocketFactory.setSocketFactory(securityEnv.getRMISocketFactory()); securityOn = true; } else { - -// InetAddress rmissfBindAddr = InetAddress.getByName("guijarro-j-3.hpl.hp.com"); -// RMIClientSocketFactory rmicsf = new org.smartfrog.sfcore.processcompound.SFClientSocketFactory(); -// RMIServerSocketFactory rmissf = new org.smartfrog.sfcore.processcompound.SFServerSocketFactory(rmissfBindAddr); -// RMISocketFactory rmisf = new SFRMISocketFactory(rmicsf, rmissf); - - System.setSecurityManager(new DummySecurityManager()); + //System.setSecurityManager(new DummySecurityManager()); + // if a java.security.policy is set then we initialize standard java security + // This is necessary for dynamic classloading to work. + String secPro = System.getProperty("java.security.policy"); + if (secPro!=null ) { + System.out.println("New Security manager added, using: "+secPro); + System.setSecurityManager(new SecurityManager()); + } + securityOn = false; //Notification moved to SFSyten after the ini file is read. } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2007-07-06 10:30:28
|
Revision: 4585 http://svn.sourceforge.net/smartfrog/?rev=4585&view=rev Author: julgui Date: 2007-07-06 03:30:27 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Fix: Replaced java.security.poliy by org.smartfrog.codebase as key used to load security manager when using dynamic classloading and not security. Modified Paths: -------------- trunk/core/smartfrog/src/org/smartfrog/SFSystem.java trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreProperty.java trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFClassLoader.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java Removed Paths: ------------- trunk/core/smartfrog/bin/sf.open.policy Deleted: trunk/core/smartfrog/bin/sf.open.policy =================================================================== --- trunk/core/smartfrog/bin/sf.open.policy 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/bin/sf.open.policy 2007-07-06 10:30:27 UTC (rev 4585) @@ -1,11 +0,0 @@ -// No security - Everything granted - -grant { - permission java.security.AllPermission; -}; - -// Standard extensions get all permissions by default -grant codeBase "file:${java.home}/lib/ext/*" { - permission java.security.AllPermission; -}; - Modified: trunk/core/smartfrog/src/org/smartfrog/SFSystem.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/SFSystem.java 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/src/org/smartfrog/SFSystem.java 2007-07-06 10:30:27 UTC (rev 4585) @@ -587,9 +587,11 @@ } // if this property is set the a sec manager is created - String secPro = System.getProperty("java.security.policy"); + String secPro = System.getProperty(SmartFrogCoreProperty.codebase); if (secPro!=null ) { if (sfLog().isDebugEnabled()) sfLog().debug("Using java security policy: "+secPro); + } else { + if (sfLog().isDebugEnabled()) sfLog().debug("No security manager loaded by SmartFrog"); } } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Diagnostics.java 2007-07-06 10:30:27 UTC (rev 4585) @@ -58,6 +58,8 @@ import java.util.TimeZone; import java.util.Vector; import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.security.SFClassLoader; + import java.net.URI; import java.net.URISyntaxException; import java.net.InetAddress; @@ -508,7 +510,7 @@ out.append("* Java security policy: ");out.append(nameP);out.append("\n"); } - nameP =System.getProperty("org.smartfrog.codebase"); + nameP =System.getProperty(SmartFrogCoreProperty.codebase); if ((nameP!=null)&& !nameP.equals("")){ out.append("* SF codebase: ");out.append(nameP);out.append("\n"); } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreProperty.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreProperty.java 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreProperty.java 2007-07-06 10:30:27 UTC (rev 4585) @@ -44,6 +44,14 @@ */ public static final String propBase = "org.smartfrog."; + /** + * Property to read the codebase for smartfrog dynamic classloading + * + * Value {@value} + * @see org.smartfrog.SFSystem + */ + public static final String codebase = SmartFrogCoreProperty.propBase+"codebase"; + /** Property name for class name for standard output stream. * * Value {@value} Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/processcompound/ProcessCompoundImpl.java 2007-07-06 10:30:27 UTC (rev 4585) @@ -42,6 +42,7 @@ import org.smartfrog.sfcore.reference.ReferencePart; import org.smartfrog.sfcore.security.SFSecurity; import org.smartfrog.sfcore.security.SFSecurityProperties; +import org.smartfrog.sfcore.security.SFClassLoader; import org.smartfrog.sfcore.common.*; @@ -1149,7 +1150,7 @@ String res = null; String replaceBoolKey = SmartFrogCoreKeys.SF_PROCESS_REPLACE_SF_CODEBASE; String attributeKey = SmartFrogCoreKeys.SF_PROCESS_SF_CODEBASE; - String sysPropertyKey = "org.smartfrog.codebase"; + String sysPropertyKey = SmartFrogCoreProperty.codebase; String pathSeparator = " "; res = addProcessSpecialSystemVar(cd, res, replaceBoolKey, attributeKey, sysPropertyKey, pathSeparator); Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFClassLoader.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFClassLoader.java 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFClassLoader.java 2007-07-06 10:30:27 UTC (rev 4585) @@ -50,7 +50,7 @@ * separated URLS) from which we download componenents and their * descriptions. */ - public static final String SF_CODEBASE_PROPERTY = SmartFrogCoreProperty.propBase+"codebase"; + public static final String SF_CODEBASE_PROPERTY = SmartFrogCoreProperty.codebase; /** Space separated urls from which we download the components */ private static String targetClassBase = null; Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2007-07-06 09:53:23 UTC (rev 4584) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2007-07-06 10:30:27 UTC (rev 4585) @@ -120,10 +120,9 @@ // This is necessary for dynamic classloading to work. String secPro = System.getProperty("java.security.policy"); if (secPro!=null ) { - System.out.println("New Security manager added, using: "+secPro); System.setSecurityManager(new SecurityManager()); } - + securityOn = false; //Notification moved to SFSyten after the ini file is read. } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-07-20 15:20:09
|
Revision: 4762 http://svn.sourceforge.net/smartfrog/?rev=4762&view=rev Author: steve_l Date: 2007-07-20 08:20:06 -0700 (Fri, 20 Jul 2007) Log Message: ----------- SFOS-207 Is there a way to automate .sxw to .pdf? Yes. Modified Paths: -------------- trunk/core/smartfrog/build.xml trunk/core/smartfrog/docs/IDE_development.pdf trunk/core/smartfrog/docs/SmartFrogTutorial.pdf trunk/core/smartfrog/docs/building_smartfrog.pdf trunk/core/smartfrog/docs/components/assertions.pdf trunk/core/smartfrog/docs/components/filesystem.pdf trunk/core/smartfrog/docs/components/java.pdf trunk/core/smartfrog/docs/sfAutoloader.pdf trunk/core/smartfrog/docs/sfDynamicWebServerExample.pdf trunk/core/smartfrog/docs/sfLogging.pdf trunk/core/smartfrog/docs/sfQuickRef.pdf trunk/core/smartfrog/docs/sfReference.pdf trunk/core/smartfrog/docs/sfShellScript.pdf trunk/core/smartfrog/docs/sfUserManual.pdf trunk/core/smartfrog/docs/sfWorkflow.pdf Added Paths: ----------- trunk/core/smartfrog/docs/components/declarative_package_loading.pdf trunk/core/smartfrog/docs/writing_a_component.pdf Modified: trunk/core/smartfrog/build.xml =================================================================== --- trunk/core/smartfrog/build.xml 2007-07-20 14:55:44 UTC (rev 4761) +++ trunk/core/smartfrog/build.xml 2007-07-20 15:20:06 UTC (rev 4762) @@ -138,8 +138,8 @@ <property name="testCA" value="testCA"/> <!-- all protected files --> <property name="private" value="private"/> - <property name="doc.dir" value="docs"/> - <property name="docs" value="${doc.dir}"/> + <property name="docs" value="docs"/> + <property name="doc.dir" location="${docs}"/> <property name="jdocs" value="${doc.dir}/jdocs"/> <property name="SFjdocs" value="${doc.dir}/SFjdocs"/> <property name="dist.lib.dir" location="${dist.dir}/${lib}"/> @@ -1117,6 +1117,7 @@ <macrodef name="bulkpdf"> <attribute name="dir" /> <sequential> + <echo>Bulk PDF conversion of @{dir}</echo> <ooo> <!--<arg value="-invisible" />--> <arg value="macro:///SmartFrog.Utils.BulkConvert(@{dir})" /> @@ -1128,6 +1129,7 @@ <target name="pdf-doc-folder" depends="init, init-ooo" description="Generate PDFs from all .SXW files in the documentation folder"> <bulkpdf dir="${doc.dir}" /> + <bulkpdf dir="${doc.dir}/components" /> </target> </project> Modified: trunk/core/smartfrog/docs/IDE_development.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/SmartFrogTutorial.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/building_smartfrog.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/components/assertions.pdf =================================================================== (Binary files differ) Added: trunk/core/smartfrog/docs/components/declarative_package_loading.pdf =================================================================== (Binary files differ) Property changes on: trunk/core/smartfrog/docs/components/declarative_package_loading.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/core/smartfrog/docs/components/filesystem.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/components/java.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfAutoloader.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfDynamicWebServerExample.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfLogging.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfQuickRef.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfReference.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfShellScript.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfUserManual.pdf =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfWorkflow.pdf =================================================================== (Binary files differ) Added: trunk/core/smartfrog/docs/writing_a_component.pdf =================================================================== (Binary files differ) Property changes on: trunk/core/smartfrog/docs/writing_a_component.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-07-25 15:58:27
|
Revision: 4785 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=4785&view=rev Author: steve_l Date: 2007-07-25 08:58:13 -0700 (Wed, 25 Jul 2007) Log Message: ----------- SFOS-314 add a -quietexit option to SfSystem Modified Paths: -------------- trunk/core/smartfrog/docs/sfQuickRef.sxw trunk/core/smartfrog/docs/sfUserManual.sxw trunk/core/smartfrog/src/org/smartfrog/SFSystem.java Modified: trunk/core/smartfrog/docs/sfQuickRef.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/docs/sfUserManual.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/src/org/smartfrog/SFSystem.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/SFSystem.java 2007-07-25 15:57:43 UTC (rev 4784) +++ trunk/core/smartfrog/src/org/smartfrog/SFSystem.java 2007-07-25 15:58:13 UTC (rev 4785) @@ -81,6 +81,12 @@ /** A flag that ensures only one system initialisation. */ private static boolean alreadySystemInit = false; + /** + * Flag to set to say "always exit with exit code 0" -this lets + * scripts run without passing their status back upstream + */ + private static boolean noExitCode=false; + /** Core Log */ private static LogSF sflog = null; @@ -255,17 +261,20 @@ /** * Exit with an error code that depends on the status of the execution - * If somethingFailed==false, we exit with {@link ExitCodes#EXIT_CODE_SUCCESS}. - * Otherwise, the exit code is passed down. + * <ol> + * <li>If somethingFailed==false, we exit with {@link ExitCodes#EXIT_CODE_SUCCESS}. + * <li>If the static variable {@link #noExitCode} is true, we exit with {@link ExitCodes#EXIT_CODE_SUCCESS}. + * <li> Otherwise, the exit code is passed down. + * </li> * @param somethingFailed flag to indicate trouble * @param exitCode exit code to exit with. */ public static void exitWithStatus(boolean somethingFailed, int exitCode) { - if(somethingFailed) { - ExitCodes.exitWithError(exitCode); - } else { - ExitCodes.exitWithError(ExitCodes.EXIT_CODE_SUCCESS); + int status = exitCode; + if (!somethingFailed || noExitCode) { + status = ExitCodes.EXIT_CODE_SUCCESS; } + ExitCodes.exitWithError(status); } @@ -473,7 +482,15 @@ } } + private void maybeGoNoExitCodeOptionSet(OptionSet opts) + { + if (opts.headless) { + sfLog().info(HEADLESS_MODE_MESSAGE); + System.setProperty("java.awt.headless", "true"); + } + } + /** * Prints StackTrace * @param thr Throwable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-08-02 16:50:04
|
Revision: 4872 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=4872&view=rev Author: steve_l Date: 2007-08-02 09:50:02 -0700 (Thu, 02 Aug 2007) Log Message: ----------- SFOS-363 NPE in test Compound -maybe when tests are skipped? Modified Paths: -------------- trunk/core/smartfrog/docs/sfQuickRef.sxw trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/conditions/components.sf Modified: trunk/core/smartfrog/docs/sfQuickRef.sxw =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/conditions/components.sf =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/conditions/components.sf 2007-08-02 16:36:05 UTC (rev 4871) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/workflow/conditional/conditions/components.sf 2007-08-02 16:50:02 UTC (rev 4872) @@ -50,17 +50,17 @@ * it can be linked to something else that is changing */ -Value extends ConditionPrim { +BooleanValue extends ConditionPrim { sfClass "org.smartfrog.sfcore.workflow.conditional.conditions.BooleanValue"; value TBD; } -True extends Value { +True extends BooleanValue { value true; } -False extends Value { +False extends BooleanValue { value false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-08-16 15:01:07
|
Revision: 5016 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=5016&view=rev Author: steve_l Date: 2007-08-16 08:01:04 -0700 (Thu, 16 Aug 2007) Log Message: ----------- an icon Modified Paths: -------------- trunk/core/smartfrog/.svnignore Added Paths: ----------- trunk/core/smartfrog/docs/images/frog.ico Modified: trunk/core/smartfrog/.svnignore =================================================================== --- trunk/core/smartfrog/.svnignore 2007-08-16 14:59:05 UTC (rev 5015) +++ trunk/core/smartfrog/.svnignore 2007-08-16 15:01:04 UTC (rev 5016) @@ -1,4 +1,5 @@ build +build2 buildextra dist build.properties Added: trunk/core/smartfrog/docs/images/frog.ico =================================================================== (Binary files differ) Property changes on: trunk/core/smartfrog/docs/images/frog.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sf...@us...> - 2007-09-18 12:19:33
|
Revision: 5118 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=5118&view=rev Author: sfpcg Date: 2007-09-18 05:19:30 -0700 (Tue, 18 Sep 2007) Log Message: ----------- Change key store type to JCEKS (SFOS-441) Modified Paths: -------------- trunk/core/smartfrog/private/buildSecurity.xml trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java trunk/core/smartfrog/testCA/codesigner.st trunk/core/smartfrog/testCA/host1/SFSecurity.properties trunk/core/smartfrog/testCA/host1/mykeys.st trunk/core/smartfrog/testCA/host10/SFSecurity.properties trunk/core/smartfrog/testCA/host10/mykeys.st trunk/core/smartfrog/testCA/host2/SFSecurity.properties trunk/core/smartfrog/testCA/host2/mykeys.st trunk/core/smartfrog/testCA/host3/SFSecurity.properties trunk/core/smartfrog/testCA/host3/mykeys.st trunk/core/smartfrog/testCA/host4/SFSecurity.properties trunk/core/smartfrog/testCA/host4/mykeys.st trunk/core/smartfrog/testCA/host5/SFSecurity.properties trunk/core/smartfrog/testCA/host5/mykeys.st trunk/core/smartfrog/testCA/host6/SFSecurity.properties trunk/core/smartfrog/testCA/host6/mykeys.st trunk/core/smartfrog/testCA/host7/SFSecurity.properties trunk/core/smartfrog/testCA/host7/mykeys.st trunk/core/smartfrog/testCA/host8/SFSecurity.properties trunk/core/smartfrog/testCA/host8/mykeys.st trunk/core/smartfrog/testCA/host9/SFSecurity.properties trunk/core/smartfrog/testCA/host9/mykeys.st Modified: trunk/core/smartfrog/private/buildSecurity.xml =================================================================== --- trunk/core/smartfrog/private/buildSecurity.xml 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/private/buildSecurity.xml 2007-09-18 12:19:30 UTC (rev 5118) @@ -55,6 +55,8 @@ <property name="defaultKeyStore" value="mykeys.st"/> <property name="defaultCodeSignerCAKeyStore" value="codesigner.st"/> + <property name="keystoreType" value="JCEKS"/> + <property name="defaultPolicyName" value="sf.policy"/> <!--length that certificates remain valid--> <property name="certificate.duration" value="365"/> @@ -182,6 +184,7 @@ verbose="true" validity="${certificate.duration}" storepass="${defaultCAPassword}" + storetype="${keystoreType}" > <dname> <param name="CN" value="sfCodeSigner"/> @@ -202,6 +205,8 @@ <arg value="${defaultCAPassword}"/> <arg value="-file"/> <arg value="codesigner.cer"/> + <arg value="-storetype"/> + <arg value="${keystoreType}"/> </sec:keytool> </target> @@ -274,6 +279,7 @@ keystore="${daemonDir}/${defaultKeyStore}" keyalg="RSA" storepass="${defaultPassword}" + storetype="${keystoreType}" dname="CN=SmartFrog${Unique}, OU=HPL, O=HP, C=UK"/> <!-- Generate request for certificate --> @@ -287,8 +293,10 @@ <arg value="${defaultPassword}"/> <arg value="-file"/> <arg value="${CAFromPrivate}/client.crs"/> + <arg value="-storetype"/> + <arg value="${keystoreType}"/> - <!--line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -certreq -alias ${aliasSelfKey} -storepass ${defaultPassword} -file ${CAFromPrivate}/client.crs"--> + <!--line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -certreq -alias ${aliasSelfKey} -storepass ${defaultPassword} -file ${CAFromPrivate}/client.crs -storetype ${ketstoreType}"--> </sec:keytool> <!-- Get the CA to sign it --> @@ -332,7 +340,7 @@ <!-- Add public of Community CA to Root of Trust --> <!-- - -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCommunityKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/${CAsubdir}/cacert.pem + -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCommunityKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/${CAsubdir}/cacert.pem -storetype ${keystoreType} --> <sec:keytool dir="${dist.private.dir}"> <arg value="-keystore"/> @@ -345,11 +353,13 @@ <arg value="${defaultPassword}"/> <arg value="-file"/> <arg value="${CAFromPrivate}/${CAsubdir}/cacert.pem"/> + <arg value="-storetype"/> + <arg value="${keystoreType}"/> </sec:keytool> <!-- Add certificate to my keys storage --> <!-- - line="-storepass ${defaultPassword} -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasSelfKey} -import -file ${CAFromPrivate}/client.crs.der"/> + line="-storepass ${defaultPassword} -keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasSelfKey} -import -file ${CAFromPrivate}/client.crs.der -storetype ${keystoreType}"/> --> <sec:keytool dir="${dist.private.dir}"> <arg value="-keystore"/> @@ -361,10 +371,12 @@ <arg value="${defaultPassword}"/> <arg value="-file"/> <arg value="${CAFromPrivate}/client.crs.der"/> + <arg value="-storetype"/> + <arg value="${keystoreType}"/> </sec:keytool> <!-- Add public of CodeSigner CA to Root of Trust --> - <!-- line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCSKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/codesigner.cer"/>--> + <!-- line="-keystore ${daemonFromPrivate}/${defaultKeyStore} -alias ${aliasCSKey} -import -noprompt -storepass ${defaultPassword} -file ${CAFromPrivate}/codesigner.cer" -storetype ${keystoreType}/>--> <exec dir="${dist.private.dir}" executable="keytool"> <arg value="-keystore"/> <arg value="${daemonFromPrivate}/${defaultKeyStore}"/> @@ -376,6 +388,8 @@ <arg value="${defaultPassword}"/> <arg value="-file"/> <arg value="${CAFromPrivate}/codesigner.cer"/> + <arg value="-storetype"/> + <arg value="${keystoreType}"/> </exec> Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java 2007-09-18 12:19:30 UTC (rev 5118) @@ -59,6 +59,9 @@ /** The name of the key store resource. */ private String keyStoreName = "sfkeys.st"; + /** the type of the keystore */ + private static final String keyStoreType = "JCEKS"; + /** The password needed to unlock the key store. */ private String keyStorePasswd = "pleasechange"; @@ -92,7 +95,8 @@ private SFDebug debug; - /** + + /** * Constructs SFSecurityEnvironmentImpl. Initializes key store, key * managers,trust managers, contexts, SSL socket factories and RMI socket * factories @@ -145,7 +149,7 @@ keyStoreName); // Open and check integrity of the key store. - ks = KeyStore.getInstance("JKS"); + ks = KeyStore.getInstance(keyStoreType); ks.load(SFClassLoader.getResourceAsStream(keyStoreName), keyStorePasswd.toCharArray()); } catch (Exception e) { Modified: trunk/core/smartfrog/testCA/codesigner.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host1/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host1/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host1/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:17:45 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=/zySDzMLwao9CybtbFoz +#Tue Sep 18 13:08:33 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=pGpe2fwsiwhw/Tze0wJr org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host1/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host10/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host10/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host10/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:18:25 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=fUVu3qMUmLebY49ZoJ+7 +#Tue Sep 18 13:10:57 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=UqCFJzP2QyUzaQL1mHXf org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host10/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host2/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host2/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host2/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:17:55 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=/a2ocwfpz34I8/3Jk3UR +#Tue Sep 18 13:08:52 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=0221Libw1uXeRNipKXDo org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host2/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host3/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host3/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host3/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:18:05 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=0KmMDpPJeudPk8ng/SG6 +#Tue Sep 18 13:09:17 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=XxDOzOAu+kiGDcGvELlN org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host3/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host4/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host4/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host4/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:18:15 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=QLDiqCTDvMH1eF+V3vEp +#Tue Sep 18 13:09:30 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=w5lChSUeLKPjtxH2L1Vy org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host4/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host5/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host5/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host5/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:19:20 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=QUe1zbdMCoYWZr29w6nT +#Tue Sep 18 13:09:41 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=2ymih77R6W5WdLCcR3zs org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host5/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host6/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host6/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host6/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:19:09 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=rTRgRkUnLPHn3Zi72QJv +#Tue Sep 18 13:09:53 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=tIcFJCorUwVR46zQTa9B org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host6/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host7/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host7/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host7/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:18:58 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=KoYe0iNyqCH6on4EN+UF +#Tue Sep 18 13:10:11 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=HFU9vUI43hgW4B96KPOl org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host7/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host8/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host8/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host8/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:18:49 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=+DReV8xY4aFxtVV7cQuk +#Tue Sep 18 13:10:26 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=k3fPyEFGomwcuQCNla3O org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host8/mykeys.st =================================================================== (Binary files differ) Modified: trunk/core/smartfrog/testCA/host9/SFSecurity.properties =================================================================== --- trunk/core/smartfrog/testCA/host9/SFSecurity.properties 2007-09-18 11:57:46 UTC (rev 5117) +++ trunk/core/smartfrog/testCA/host9/SFSecurity.properties 2007-09-18 12:19:30 UTC (rev 5118) @@ -1,3 +1,3 @@ -#Thu May 26 13:18:38 BST 2005 -org.smartfrog.sfcore.security.keyStorePassword=6SrDibd5ttj+y1D9zRZ6 +#Tue Sep 18 13:10:40 BST 2007 +org.smartfrog.sfcore.security.keyStorePassword=TxRJ/5AcKK9x4DGxkHZI org.smartfrog.sfcore.security.activate=true Modified: trunk/core/smartfrog/testCA/host9/mykeys.st =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sf...@us...> - 2007-09-18 14:32:27
|
Revision: 5119 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=5119&view=rev Author: sfpcg Date: 2007-09-18 07:32:24 -0700 (Tue, 18 Sep 2007) Log Message: ----------- HMac service initialized from the host key store, plus changes to the security build process to include the keys required. (SFOS-442) Modified Paths: -------------- trunk/core/smartfrog/private/buildSecurity.xml trunk/core/smartfrog/src/org/smartfrog/sfcore/security/MACData.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java Added Paths: ----------- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/CopySecretKey.java trunk/core/smartfrog/src/org/smartfrog/sfcore/security/GenerateSecretKey.java Modified: trunk/core/smartfrog/private/buildSecurity.xml =================================================================== --- trunk/core/smartfrog/private/buildSecurity.xml 2007-09-18 12:19:30 UTC (rev 5118) +++ trunk/core/smartfrog/private/buildSecurity.xml 2007-09-18 14:32:24 UTC (rev 5119) @@ -66,6 +66,8 @@ <property name="aliasCSKey" value="sfcodesigner"/> <property name="aliasCommunityKey" value="sfcommunity"/> <property name="aliasSelfKey" value="self"/> + <property name="aliasMACDataKey" value="macdata"/> + <property name="randomFile" value=".rnd"/> <property name="tempPasswdFile" value="passwd"/> <property name="hostDirPrefix" value="host"/> @@ -208,6 +210,20 @@ <arg value="-storetype"/> <arg value="${keystoreType}"/> </sec:keytool> + + <!-- Generate and store secret key for MACData service --> + <java classname="org.smartfrog.sfcore.security.GenerateSecretKey" failonerror="true"> + <arg value="-password"/> + <arg value="${defaultCAPassword}"/> + <arg value="-file"/> + <arg value="${CA}/${defaultCodeSignerCAKeyStore}"/> + <arg value="-alias"/> + <arg value="${aliasMACDataKey}"/> + <classpath> + <fileset dir="${dist.lib.dir}" includes="*.jar" /> + <pathelement path="${java.class.path}"/> + </classpath> + </java> </target> @@ -393,6 +409,24 @@ </exec> + <!-- copy secret key for MACData service from the codesigner keystore to host keystore --> + <java classname="org.smartfrog.sfcore.security.CopySecretKey" failonerror="true"> + <arg value="-sourcepassword"/> + <arg value="${defaultCAPassword}"/> + <arg value="-sourcefile"/> + <arg value="${CA}/${defaultCodeSignerCAKeyStore}"/> + <arg value="-destpassword"/> + <arg value="${defaultPassword}"/> + <arg value="-destfile"/> + <arg value="${dist.private.dir}/${daemonFromPrivate}/${defaultKeyStore}"/> + <arg value="-alias"/> + <arg value="${aliasMACDataKey}"/> + <classpath> + <fileset dir="${dist.lib.dir}" includes="*.jar" /> + <pathelement path="${java.class.path}"/> + </classpath> + </java> + <!-- Create ad-hoc security properties file --> <copy file="${dist.private.dir}/${defaultSecProp}" tofile="${daemonDir}/${defaultSecProp}"/> <propertyfile file="${daemonDir}/${defaultSecProp}"> Added: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/CopySecretKey.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/CopySecretKey.java (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/CopySecretKey.java 2007-09-18 14:32:24 UTC (rev 5119) @@ -0,0 +1,84 @@ +package org.smartfrog.sfcore.security; + +import java.io.*; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.security.KeyStoreException; +import java.security.UnrecoverableEntryException; +import java.security.cert.CertificateException; + +/** + * Copy the secret key from one file to another - each encrypted with a different key + */ +public class CopySecretKey { + private static final String skeystoreOpt = "-sourcefile"; + private static final String spasswordOpt = "-sourcepassword"; + private static final String dkeystoreOpt = "-destfile"; + private static final String dpasswordOpt = "-destpassword"; + private static final String aliasOpt = "-alias"; + + private static final String usage = "usage: java org.smartfrog.sfcore.security.CopySecretKey" + + " " + skeystoreOpt + " <filename>" + + " " + spasswordOpt + " <password>" + + " " + dkeystoreOpt + " <filename>" + + " " + dpasswordOpt + " <password>" + + " " + aliasOpt + " <alias>"; + + public static void main(String[] args) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException, UnrecoverableEntryException { + String skeystore = ""; + String spassword = ""; + String dkeystore = ""; + String dpassword = ""; + String alias = ""; + + if (args.length != 10) { + System.out.println(usage); + System.exit(1); + } + + for (int i = 0; i < args.length; i += 2) { + if (((String) args[i]).equals(skeystoreOpt)) { + skeystore = args[i + 1]; + } else if (((String) args[i]).equals(spasswordOpt)) { + spassword = args[i + 1]; + } else if (((String) args[i]).equals(dkeystoreOpt)) { + dkeystore = args[i + 1]; + } else if (((String) args[i]).equals(dpasswordOpt)) { + dpassword = args[i + 1]; + } else if (((String) args[i]).equals(aliasOpt)) { + alias = args[i + 1]; + } else { + System.out.println(usage); + System.exit(1); + } + } + + if (skeystore.equals("") || spassword.equals("") || dkeystore.equals("") || dpassword.equals("") || alias.equals("")) { + System.out.println(usage); + System.exit(1); + } + + System.out.println("Copying secret key, alias " + alias + ", from keystore " + skeystore + ", to keystore " + dkeystore); + + InputStream is = new FileInputStream(skeystore); + KeyStore ks = KeyStore.getInstance("JCEKS"); + ks.load(is, spassword.toCharArray()); + is.close(); + + KeyStore.SecretKeyEntry skEntry = (KeyStore.SecretKeyEntry)ks.getEntry(alias, new KeyStore.PasswordProtection(spassword.toCharArray())); + + is = new FileInputStream(dkeystore); + ks = KeyStore.getInstance("JCEKS"); + ks.load(is, dpassword.toCharArray()); + is.close(); + + ks.setEntry(alias, skEntry, new KeyStore.PasswordProtection(dpassword.toCharArray())); + + OutputStream os = new FileOutputStream(dkeystore); + ks.store(os, dpassword.toCharArray()); + os.close(); + + System.out.println("Successfully copied secret key, alias " + alias + ", from keystore " + skeystore + ", to keystore " + dkeystore); + + } +} Added: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/GenerateSecretKey.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/GenerateSecretKey.java (rev 0) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/GenerateSecretKey.java 2007-09-18 14:32:24 UTC (rev 5119) @@ -0,0 +1,75 @@ +package org.smartfrog.sfcore.security; + +import javax.crypto.SecretKey; +import javax.crypto.KeyGenerator; +import java.io.*; +import java.security.SecureRandom; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +/** + * This is only necesary until we commit to jdk 1.6 at which point keeytool introduces + * the genSercretKey command. + */ +public class GenerateSecretKey { + private static final String keystoreOpt = "-file"; + private static final String passwordOpt = "-password"; + private static final String aliasOpt = "-alias"; + + + private static final String usage = "usage: java org.smartfrog.sfcore.security.GenSecretKey" + + " " + keystoreOpt + " <filename>" + + " " + passwordOpt + " <password>" + + " " + aliasOpt + " <alias>"; + + public static void main(String[] args) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException { + String keystore = ""; + String password = ""; + String alias = ""; + SecureRandom rand = new SecureRandom(); + byte[] key = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + + if (args.length != 6) { + System.out.println(usage); + System.exit(1); + } + + for (int i = 0; i < args.length; i += 2) { + if (((String) args[i]).equals(keystoreOpt)) { + keystore = args[i + 1]; + } else if (((String) args[i]).equals(passwordOpt)) { + password = args[i + 1]; + } else if (((String) args[i]).equals(aliasOpt)) { + alias = args[i + 1]; + }else { + System.out.println(usage); + System.exit(1); + } + } + + if (keystore.equals("") || password.equals("") || alias.equals("")) { + System.out.println(usage); + System.exit(1); + } + + System.out.println("Generating secret key, alias " + alias + ", keystore " + keystore); + + InputStream is = new FileInputStream(keystore); + KeyStore ks = KeyStore.getInstance("JCEKS"); + ks.load(is, password.toCharArray()); + is.close(); + + SecretKey mySecretKey = KeyGenerator.getInstance("HmacSHA1").generateKey(); + KeyStore.SecretKeyEntry skEntry = + new KeyStore.SecretKeyEntry(mySecretKey); + ks.setEntry(alias, skEntry, new KeyStore.PasswordProtection(password.toCharArray())); + + OutputStream os = new FileOutputStream(keystore); + ks.store(os, password.toCharArray()); + os.close(); + + System.out.println("Successfully generated secret key, alias " + alias + ", keystore " + keystore); + } +} Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/MACData.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/MACData.java 2007-09-18 12:19:30 UTC (rev 5118) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/MACData.java 2007-09-18 14:32:24 UTC (rev 5119) @@ -1,13 +1,13 @@ package org.smartfrog.sfcore.security; +import org.smartfrog.sfcore.common.SmartFrogException; + import javax.crypto.Mac; import javax.crypto.ShortBufferException; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; -import java.security.Key; -import java.security.NoSuchAlgorithmException; -import java.security.InvalidKeyException; +import java.security.*; /** * Calculate/check the MAC associated with data in a byte array. @@ -22,52 +22,36 @@ public class MACData { private static String macType = "HmacSHA1"; //Use HmacSHA512 for better protection private static int macSize = 20; //size in bytes + private static String keyAlias = "macdata"; - private static Key defaultKey = null; - - /** - * Initialise the default key to be the provided key for MAC generation. - * This is used when SmartFrog security is on, extracting the key from the keystore. - * May be overridden by a further call by some key distribution service. - */ - public static void setDefaultKey(Key k) throws InvalidKeyException { - Mac defaultMac; - try { - defaultMac = Mac.getInstance(macType); - defaultMac.init(k); - defaultKey = k; //will only happen if its a legal key!!! - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); //shouldn't happen as predefined to work... - } - } - - /** - * Initialise the default key to be the standard key for MAC generation. - * This is used when SmartFrog security is off so a secure key is not required - */ - public static void setStandardDefaultKey() { - byte[] keyData = { + private static byte[] defaultKeyData = { (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, (byte) 0x23, (byte) 0x46, (byte) 0x83, (byte) 0xad, (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad }; - defaultKey = new SecretKeySpec(keyData, "HmacSHA1"); - } + private static Key defaultKey = new SecretKeySpec(defaultKeyData, macType); + private Mac lastMAC = null; private Mac currentMAC = null; - private Mac defaultMAC = null; //only to be used if no key set + private Mac defaultMAC = null; //only to be used if no key explicitly set - public MACData() { - if (defaultKey != null) { + public MACData() throws SmartFrogException { + try { + defaultMAC = Mac.getInstance(macType); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); //shouldn't ever happen... + } + if (SFSecurity.isSecurityOn()) { try { - defaultMAC = Mac.getInstance(macType); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); //shouldn't happen as predefined to work... + Key k = ((KeyStore.SecretKeyEntry)(((SFSecurityEnvironmentImpl) SFSecurity.getSecurityEnvironment()).getEntry(keyAlias))).getSecretKey(); + defaultMAC.init(k); + } catch (Exception e) { + throw new SmartFrogException("Error in setting up security of MACData service", e); } - + } else { try { defaultMAC.init(defaultKey); } catch (InvalidKeyException e) { @@ -159,13 +143,6 @@ public static void main(String[] args) { //for testing try { - byte[] keyData1 = { - (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, - (byte) 0x23, (byte) 0x46, (byte) 0x83, (byte) 0xad, - (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, - (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, - (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad - }; byte[] keyData2 = { (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, @@ -173,9 +150,9 @@ (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad, (byte) 0x23, (byte) 0x45, (byte) 0x83, (byte) 0xad }; - SecretKey sk1 = new SecretKeySpec(keyData1, "HmacSHA1"); - SecretKey sk2 = new SecretKeySpec(keyData2, "HmacSHA1"); + SecretKey sk2 = new SecretKeySpec(keyData2, macType); + int startOffset = 0; int endOffset = 15; byte[] data1 = { @@ -205,7 +182,7 @@ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; - MACData.setDefaultKey(sk1); + MACData m1a = new MACData(); MACData m2a = new MACData(); m2a.setKey(sk2); Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2007-09-18 12:19:30 UTC (rev 5118) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurity.java 2007-09-18 14:32:24 UTC (rev 5119) @@ -114,9 +114,6 @@ classes are available in our codebase...*/ RMISocketFactory.setSocketFactory(securityEnv.getRMISocketFactory()); - //@TODO: must put this right - get it out of the keystore!!!!!!!! - MACData.setStandardDefaultKey(); // no security default MAC key set - securityOn = true; } else { //System.setSecurityManager(new DummySecurityManager()); @@ -127,8 +124,6 @@ System.setSecurityManager(new SecurityManager()); } - MACData.setStandardDefaultKey(); // no security default MAC key set - securityOn = false; //Notification moved to SFSyten after the ini file is read. } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java 2007-09-18 12:19:30 UTC (rev 5118) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/security/SFSecurityEnvironmentImpl.java 2007-09-18 14:32:24 UTC (rev 5119) @@ -25,6 +25,9 @@ import java.rmi.server.RMIServerSocketFactory; import java.rmi.server.RMISocketFactory; import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableEntryException; +import java.security.KeyStoreException; import java.security.cert.Certificate; import java.net.InetAddress; @@ -233,6 +236,13 @@ rmisf = new SFRMISocketFactory(rmicsf, rmissf); } + /** + * Get the keystore Entry associated with a specific alias + */ + KeyStore.Entry getEntry (String alias) throws NoSuchAlgorithmException, UnrecoverableEntryException, KeyStoreException { + return ks.getEntry(alias, new KeyStore.PasswordProtection(keyStorePasswd.toCharArray())); + } + /** * Gets a set of key managers associated with SF private keys, in the key * store, that JSSE needs. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-09-21 10:11:53
|
Revision: 5152 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=5152&view=rev Author: steve_l Date: 2007-09-21 03:11:51 -0700 (Fri, 21 Sep 2007) Log Message: ----------- adding some binary file load/save operations Modified Paths: -------------- trunk/core/smartfrog/sf-build-version.properties trunk/core/smartfrog/src/org/smartfrog/services/filesystem/FileSystem.java Modified: trunk/core/smartfrog/sf-build-version.properties =================================================================== --- trunk/core/smartfrog/sf-build-version.properties 2007-09-21 10:04:09 UTC (rev 5151) +++ trunk/core/smartfrog/sf-build-version.properties 2007-09-21 10:11:51 UTC (rev 5152) @@ -2,4 +2,4 @@ sf.majorRelease=3 sf.minorRelease=12 sf.build=003 -sf.status=dev \ No newline at end of file +sf.status= \ No newline at end of file Modified: trunk/core/smartfrog/src/org/smartfrog/services/filesystem/FileSystem.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/services/filesystem/FileSystem.java 2007-09-21 10:04:09 UTC (rev 5151) +++ trunk/core/smartfrog/src/org/smartfrog/services/filesystem/FileSystem.java 2007-09-21 10:11:51 UTC (rev 5152) @@ -44,6 +44,7 @@ import java.io.InputStreamReader; import java.io.BufferedInputStream; import java.io.OutputStreamWriter; +import java.io.FileNotFoundException; import java.net.URL; import java.util.ListIterator; import java.util.List; @@ -538,11 +539,6 @@ return; } blockcopy(src,dest); -/* - validateCopyDestination(dest); - FileInputStream inputStream = new FileInputStream(src); - fCopy(inputStream, dest); -*/ } /** @@ -937,4 +933,77 @@ ioe); } } + + /** + * Write to a text file + * + * @param file file to write to + * @param text text to write + * @param encoding encoding file encoding + * @throws SmartFrogException on any failure to write the file + */ + public static void writeTextFile(File file, String text, Charset encoding) throws SmartFrogException { + Writer wout = null; + try { + OutputStream fout; + fout = new FileOutputStream(file); + wout = new OutputStreamWriter(fout, encoding); + wout.write(text); + wout.flush(); + wout.close(); + } catch (IOException ioe) { + close(wout); + throw SmartFrogException.forward("When trying to write to " + + file, + ioe); + } + } + + private String loadIntoBuffer(File inFile) throws Exception { + // open the file + FileInputStream in = null; + try { + in = new FileInputStream(inFile); + + // set the buffer size + byte[] buffer = new byte[in.available()]; + + // read the content + in.read(buffer); + return new String(buffer); + } finally { + // close the file + FileSystem.close(in); + } + + + } + + /** + * Read a binary file into a buffer. + * @param file file to read + * @param limit limit on the buffer size + * @return the buffer + * @throws IOException + */ + public static byte[] readBinaryFile(File file,int limit) throws IOException { + // open the file + FileInputStream in = null; + try { + in = new FileInputStream(file); + // set the buffer size + int size = in.available(); + if(size>limit) { + throw new IOException("File size too large: limit:"+limit+" actual "+size); + } + + byte[] buffer = new byte[size]; + // read the content + in.read(buffer); + return buffer; + } finally { + // close the file + close(in); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <st...@us...> - 2007-09-25 15:44:35
|
Revision: 5165 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=5165&view=rev Author: steve_l Date: 2007-09-25 08:44:32 -0700 (Tue, 25 Sep 2007) Log Message: ----------- SFOS-437 installation problem: lib/ not found Modified Paths: -------------- trunk/core/smartfrog/build.xml trunk/core/smartfrog/buildRelease.xml Modified: trunk/core/smartfrog/build.xml =================================================================== --- trunk/core/smartfrog/build.xml 2007-09-25 15:19:01 UTC (rev 5164) +++ trunk/core/smartfrog/build.xml 2007-09-25 15:44:32 UTC (rev 5165) @@ -268,6 +268,8 @@ <!-- --> <!-- =================================================================== --> <target name="initbuild" depends="init"> + <!--for redistributions, the lib dir is empty--> + <mkdir dir="lib"/> <mkdir dir="${build.dir}"/> <mkdir dir="${build.classes.dir}"/> <mkdir dir="${build.extra.dir}"/> Modified: trunk/core/smartfrog/buildRelease.xml =================================================================== --- trunk/core/smartfrog/buildRelease.xml 2007-09-25 15:19:01 UTC (rev 5164) +++ trunk/core/smartfrog/buildRelease.xml 2007-09-25 15:44:32 UTC (rev 5165) @@ -255,6 +255,8 @@ <include name="changes.txt"/> <include name="readme.txt"/> <include name="sf-build-version.properties"/> + <!--notice how this pulls in the directory, but not its contents--> + <include name="lib" /> <patternset refid="excluded.cruft"/> </patternset> @@ -614,80 +616,6 @@ <target name="expand" depends="unzip,untar" description="make the distributables, then expand them" /> - <!-- <target name="oldrelease" depends="dist-zip" > - - <tar tarfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" > - <tarfileset dir="." prefix="${prefix}"> - <include name="${dist}/bin/**/*.sf"/> - <include name="${dist}/bin/**/*.bat"/> - <include name="${dist}/bin/**/*.ini"/> - </tarfileset> - <tarfileset dir="." prefix="${prefix}" > - <exclude name="${dist}/bin/**"/> - <include name="${dist}/**"/> - <exclude name="${dist}/classes/**"/> - <exclude name="${dist}/docs/**"/> - <patternset refid="excluded.cruft"/> - </tarfileset> - <tarfileset dir="${dist}/docs/" prefix="${prefix}/dist/docs"> - <patternset refid="docs.pattern" /> - </tarfileset> - <tarfileset dir="." mode="755" prefix="${prefix}"> - <include name="${dist}/bin/**"/> - <exclude name="${dist}/bin/**/*.sf"/> - <exclude name="${dist}/bin/**/*.bat"/> - <exclude name="${dist}/bin/**/*.ini"/> - </tarfileset> - </tar> - <gzip src="${release.dir}/${prefix}.${DSTAMP}_DIST.tar" - zipfile="${release.dir}/${prefix}.${DSTAMP}_DIST.tar.gz"/> - <delete file="${release.dir}/${prefix}.${DSTAMP}_DIST.tar"/> - - <tar tarfile="${release.dir}/${prefix}.${DSTAMP}_ALL.tar" > - <tarfileset dir="." prefix="${prefix}"> - <include name="bin/**/*.sf"/> - <include name="bin/**/*.bat"/> - <include name="bin/**/*.ini"/> - <include name="lib/**"/> - --><!--include name="lib/*-${version}.jar"/> - <include name="lib/readme.txt"/--><!-- - <patternset refid="source.pattern"/> - </tarfileset> - <tarfileset dir="bin" prefix="${prefix}/bin" mode="755"> - <patternset refid="unix.bin" /> - <include name="bin/**"/> - <exclude name="bin/**/*.sf"/> - <exclude name="bin/**/*.bat"/> - <exclude name="bin/**/*.ini"/> - </tarfileset> - <tarfileset dir="docs/" prefix="${prefix}/docs"> - <patternset refid="docs.pattern" /> - </tarfileset> - <tarfileset dir="${dist}/docs/" prefix="${prefix}/dist/docs"> - <patternset refid="docs.pattern" /> - </tarfileset> - <tarfileset dir="." prefix="${prefix}"> - <include name="${dist}/bin/**/*.sf"/> - <include name="${dist}/bin/**/*.bat"/> - <include name="${dist}/bin/**/*.ini"/> - </tarfileset> - <tarfileset dir="." prefix="${prefix}"> - <exclude name="${dist}/bin/**"/> - <include name="${dist}/**"/> - <exclude name="${dist}/classes/**"/> - <exclude name="${dist}/classes/**"/> - <exclude name="${dist}/docs/**"/> - </tarfileset> - <tarfileset dir="." mode="755" prefix="${prefix}"> - <include name="${dist}/bin/**"/> - <exclude name="${dist}/bin/**/*.sf"/> - <exclude name="${dist}/bin/**/*.bat"/> - <exclude name="${dist}/bin/**/*.ini"/> - </tarfileset> - </tar> - <gzip src="${release.dir}/${prefix}.${DSTAMP}_ALL.tar" zipfile="${release.dir}/${prefix}.${DSTAMP}_ALL.tar.gz"/> - <delete file="${release.dir}/${prefix}.${DSTAMP}_ALL.tar"/> - </target>--> </project> <!-- End of file --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |